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 7268943901 for ; Wed, 3 Aug 2022 14:00:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5AC5C68B93A; Wed, 3 Aug 2022 16:59:13 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B6AF68B878 for ; Wed, 3 Aug 2022 16:59:06 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B67E924056A for ; Wed, 3 Aug 2022 15:59:04 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ZPYZopWkJ7du for ; Wed, 3 Aug 2022 15:59:04 +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 1B974240685 for ; Wed, 3 Aug 2022 15:58:55 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 23C133A04C6; Wed, 3 Aug 2022 15:58:52 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 3 Aug 2022 15:58:33 +0200 Message-Id: <20220803135844.16662-14-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 14/25] fftools/ffmpeg: always read input in a thread 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: This will be required by the following architecture changes. --- fftools/ffmpeg.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index f12364fe0a..7ba1f2a8cf 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3713,10 +3713,8 @@ static int init_input_thread(int i) int ret; InputFile *f = input_files[i]; - if (f->thread_queue_size < 0) - f->thread_queue_size = (nb_input_files > 1 ? 8 : 0); - if (!f->thread_queue_size) - return 0; + if (f->thread_queue_size <= 0) + f->thread_queue_size = (nb_input_files > 1 ? 8 : 1); if (f->ctx->pb ? !f->ctx->pb->seekable : strcmp(f->ctx->iformat->name, "lavfi")) @@ -3747,13 +3745,6 @@ static int init_input_threads(void) return 0; } -static int get_input_packet_mt(InputFile *f, AVPacket **pkt) -{ - return av_thread_message_queue_recv(f->in_thread_queue, pkt, - f->non_blocking ? - AV_THREAD_MESSAGE_NONBLOCK : 0); -} - static int get_input_packet(InputFile *f, AVPacket **pkt) { if (f->readrate || f->rate_emu) { @@ -3775,10 +3766,9 @@ static int get_input_packet(InputFile *f, AVPacket **pkt) } } - if (f->thread_queue_size) - return get_input_packet_mt(f, pkt); - *pkt = f->pkt; - return av_read_frame(f->ctx, *pkt); + return av_thread_message_queue_recv(f->in_thread_queue, pkt, + f->non_blocking ? + AV_THREAD_MESSAGE_NONBLOCK : 0); } static int got_eagain(void) @@ -4162,10 +4152,7 @@ static int process_input(int file_index) process_input_packet(ist, pkt, 0); discard_packet: - if (ifile->thread_queue_size) - av_packet_free(&pkt); - else - av_packet_unref(pkt); + av_packet_free(&pkt); return 0; } -- 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".