From patchwork Wed Sep 4 10:17:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 14890 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2F8EB44A453 for ; Wed, 4 Sep 2019 13:18:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DBAC680C0D; Wed, 4 Sep 2019 13:18:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5BF24687F5B for ; Wed, 4 Sep 2019 13:18:01 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id AF7CFA16FC for ; Wed, 4 Sep 2019 12:18:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id W12-ir8aKwOj for ; Wed, 4 Sep 2019 12:17:56 +0200 (CEST) To: ffmpeg-devel@ffmpeg.org References: <2ca297b9-fdba-3c01-7567-61486f5f4924@gyani.pro> <20190902155403.GD3219@michaelspb> From: Gyan Message-ID: <75acde42-0192-4baa-41dc-2956ab6d3993@gyani.pro> Date: Wed, 4 Sep 2019 15:47:50 +0530 MIME-Version: 1.0 In-Reply-To: <20190902155403.GD3219@michaelspb> Content-Language: en-US Subject: Re: [FFmpeg-devel] [PATCH] ffmpeg: switch to avformat_seek_file for stream_loop 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 02-09-2019 09:24 PM, Michael Niedermayer wrote: > On Sat, Aug 31, 2019 at 08:28:51PM +0530, Gyan wrote: >> A user observed that stream_loop didn't work with very short FLV files. >> seek_to_start in ffmpeg.c calls av_seek_frame with no flags; FLV seek only >> works with RTMP protocol so lavf falls back on seek_frame_generic which >> searches forward, skipping a GOP. With files with two index entries in >> stream, the file doesn't loop at all. >> >> I switched to avformat_seek_file which will set the BACKWARDS flag when >> seeking to start of file. stream_loop works and no frames are dropped. >> >> FATE passes. >> >> Gyan >> ffmpeg.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> c79dc6d27a9c8c1bd0cffa2d251b2aa7caf23bf3 0001-ffmpeg-switch-to-avformat_seek_file-for-stream_loop.patch >> From 4af64f612c65378f0a220284ca99ad033ece8cd3 Mon Sep 17 00:00:00 2001 >> From: Gyan Doshi >> Date: Sat, 31 Aug 2019 19:45:58 +0530 >> Subject: [PATCH] ffmpeg: switch to avformat_seek_file for stream_loop >> >> Fixes stream_loop with very short files where seeking is generic index >> search >> --- >> fftools/ffmpeg.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > probably ok > > it also might make sense to add the testcase to fate as you mentioned "short" > New patches attached. Will send file to samples-request. Gyan From 953c9c11d90aa69121825284d5f6bf0c34793b2d Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sat, 31 Aug 2019 19:45:58 +0530 Subject: [PATCH 1/2] ffmpeg: switch to avformat_seek_file for stream_loop Fixes stream_loop with very short files where seeking is generic index search --- fftools/ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 01f04103cf..b6ecb89893 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4195,7 +4195,7 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is) int i, ret, has_audio = 0; int64_t duration = 0; - ret = av_seek_frame(is, -1, is->start_time, 0); + ret = avformat_seek_file(is, -1, INT64_MIN, is->start_time, is->start_time, 0); if (ret < 0) return ret;