From patchwork Wed Jun 27 21:05:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 9528 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1306528jad; Wed, 27 Jun 2018 14:05:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeg8A9NlROVB3f5EAWi6/KdYnnds5SR1i3bJIRmYkodNwmO4A5yDZGaYuWQh5mHrg5I8dM4 X-Received: by 2002:a1c:1389:: with SMTP id 131-v6mr6183605wmt.65.1530133546817; Wed, 27 Jun 2018 14:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530133546; cv=none; d=google.com; s=arc-20160816; b=sWh2HKxLztqi6f+RLLvK9dtzr2knqKH1l/xeOfIKgP0gN1YcDQldOJBXV3Qu81f9vN N55W+0Np3bvZUVRRGPP7q8ltDbyt/JKmKzdHb4mS0owLzSWQjGKdesOGTGHgJcwzwscl d7gjhYMf/hsL6ZvcFod45fkzCoGmrmZdqmL9cvkdmB5vhREBe9Sx9pqUA+bS8oudbqOp tg/BK5Q6StLYKmK2RavusZqe+1YsiCjvpwjN5ZtYZ/kGo+Qq3j2QpDqu4i/L3vTcSqe3 dQVnP3jvoJlYWAfVe38oYub/yT7zC5caQ+sxrHDe1sNUVIxIX4EioX9vZaB/RzEwl62Z /rgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=dJNz6/ComRhYzjrGVkX0xHVB7tbt3umrZnKxwGX5RTU=; b=xvQMUOkwV5mXWi8R9uAdqma6wq48ieCL4MnFe7klSaLdfGON2ZvSsWyV1fEAPhrnA2 IOD1Vs8q5g5IyD8kXDZZEq1mWAB2JV7W0ze854J+c/ha0vTEPPsbp5vsvmB+4mnVVpsW 0UbHMJRzclERIOa4pBgrbECYL3N2IBuIFVh4m1ihykXk8XVPdjQUXtmREeEGnBtXL2uo 96BSh6CQq9lOYYvgaiJxA2pEpBKVMqmPFWv7AMSYJrTZ0Lv/50ssRCvQLTvFKYVB1s5j MDxBL5QrKFqDg8qBOg7Uh/PpSVVNzCBe2oAHcN7wP090QKXfNbtryhP2G1Sfpx6tvA3S K5Ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v99-v6si5243124wrb.261.2018.06.27.14.05.46; Wed, 27 Jun 2018 14:05:46 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F04368A56A; Thu, 28 Jun 2018 00:05:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3F1C68A538 for ; Thu, 28 Jun 2018 00:05:29 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1E979E104D; Wed, 27 Jun 2018 23:05:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id heBXZ86gd8TG; Wed, 27 Jun 2018 23:05:30 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 51E42E1019; Wed, 27 Jun 2018 23:05:30 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Jun 2018 23:05:23 +0200 Message-Id: <20180627210523.22126-2-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180627210523.22126-1-cus@passwd.hu> References: <20180627210523.22126-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/2] ffmpeg: fix -stream_loop with multiple inputs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The input thread need to be properly cleaned up and re-initalized before we can start reading again in threaded mode. (threaded input reading is used when there are mode than one input file). Signed-off-by: Marton Balint --- fftools/ffmpeg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 8f94c5fff2..e2cd78fcd0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4251,7 +4251,7 @@ static int process_input(int file_index) AVFormatContext *is; InputStream *ist; AVPacket pkt; - int ret, i, j; + int ret, thread_ret, i, j; int64_t duration; int64_t pkt_dts; @@ -4274,7 +4274,15 @@ static int process_input(int file_index) avcodec_flush_buffers(avctx); } } +#if HAVE_THREADS + free_input_thread(file_index); +#endif ret = seek_to_start(ifile, is); +#if HAVE_THREADS + thread_ret = init_input_thread(file_index); + if (thread_ret < 0) + return thread_ret; +#endif if (ret < 0) av_log(NULL, AV_LOG_WARNING, "Seek to start failed.\n"); else