[FFmpeg-devel] [PATCH 2/2] ffmpeg: make seeking back to file start more robust

Marton Balint cus at passwd.hu
Sun Jul 3 01:33:32 EEST 2016


av_seek_frame to start time can fail and it can also seek after the start of
the stream...

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f06fee5..83a179ee 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3723,7 +3723,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, INT64_MIN, INT64_MAX, 0);
     if (ret < 0)
         return ret;
 
-- 
2.6.6



More information about the ffmpeg-devel mailing list