From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 77D3943934 for ; Wed, 3 Aug 2022 14:01:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5C2D568B87F; Wed, 3 Aug 2022 16:59:16 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A0F6C68B896 for ; Wed, 3 Aug 2022 16:59:06 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B09FF240593 for ; Wed, 3 Aug 2022 15:59:05 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id w5BLaMEgzg0B for ; Wed, 3 Aug 2022 15:59:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 2332F24068D for ; Wed, 3 Aug 2022 15:58:55 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 514E03A07D1; Wed, 3 Aug 2022 15:58:52 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 3 Aug 2022 15:58:43 +0200 Message-Id: <20220803135844.16662-24-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220803135844.16662-1-anton@khirnov.net> References: <20220803135844.16662-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 24/25] fftools/ffmpeg_demux: do not store demux packet in the context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Its use is local to input_thread(). --- fftools/ffmpeg.c | 1 - fftools/ffmpeg.h | 2 -- fftools/ffmpeg_demux.c | 11 ++++++++++- fftools/ffmpeg_opt.c | 3 --- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0218f330b9..a9eda3c33e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -593,7 +593,6 @@ static void ffmpeg_cleanup(int ret) free_input_threads(); for (i = 0; i < nb_input_files; i++) { avformat_close_input(&input_files[i]->ctx); - av_packet_free(&input_files[i]->pkt); av_freep(&input_files[i]); } for (i = 0; i < nb_input_streams; i++) { diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index aa97f35310..2ac7cbe522 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -437,8 +437,6 @@ typedef struct InputFile { float readrate; int accurate_seek; - AVPacket *pkt; - AVThreadMessageQueue *in_thread_queue; pthread_t thread; /* thread reading from this file */ int non_blocking; /* reading packets from the thread should not block */ diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index be734be581..af54ea3de1 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -117,10 +117,16 @@ static int seek_to_start(InputFile *ifile) static void *input_thread(void *arg) { InputFile *f = arg; - AVPacket *pkt = f->pkt; + AVPacket *pkt; unsigned flags = f->non_blocking ? AV_THREAD_MESSAGE_NONBLOCK : 0; int ret = 0; + pkt = av_packet_alloc(); + if (!pkt) { + ret = AVERROR(ENOMEM); + goto finish; + } + while (1) { DemuxMsg msg = { NULL }; @@ -185,9 +191,12 @@ static void *input_thread(void *arg) } } +finish: av_assert0(ret < 0); av_thread_message_queue_set_err_recv(f->in_thread_queue, ret); + av_packet_free(&pkt); + return NULL; } diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 25aa9aaff5..97f14b2a5b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1407,9 +1407,6 @@ static int open_input_file(OptionsContext *o, const char *filename) f->rate_emu = 0; } - f->pkt = av_packet_alloc(); - if (!f->pkt) - exit_program(1); f->thread_queue_size = o->thread_queue_size; /* check if all codec options have been used */ -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".