From: Jonas Licht <[email protected]>

Subtract the calculated dts offset from the requested timestamp before
seeking. This fixes an error "Error while filtering: Operation not
permitted" observed with a short file which contains only one key frame
and starts with negative timestamps.

Signed-off-by: Jonas Licht <[email protected]>
---

This fixes looping with sample file 
https://trac.ffmpeg.org/raw-attachment/ticket/6139/loop.mp4

 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6711d8e11e..e4ab6ff6e0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4017,6 +4017,8 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
     int sample, time_sample;
     unsigned int i;
 
+    timestamp -= sc->time_offset;
+
     sample = av_index_search_timestamp(st, timestamp, flags);
     av_log(s, AV_LOG_TRACE, "stream %d, timestamp %"PRId64", sample %d\n", 
st->index, timestamp, sample);
     if (sample < 0 && st->nb_index_entries && timestamp < 
st->index_entries[0].timestamp)
-- 
2.13.6

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to