[FFmpeg-devel] [PATCH] libavformat/mov.c: use calculated dts offset when seeking in streams
Jonas Licht
jonas.licht at fem.tu-ilmenau.de
Tue Jun 20 00:08:45 EEST 2017
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.
Then, av_index_search_timestamp() returns a valid negative timestamp,
but mov_seek_stream bails out with AVERROR_INVALIDDATA.
Fixes ticket #6139.
Signed-off-by: Jonas Licht <jonas.licht at fem.tu-ilmenau.de>
---
libavformat/mov.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 63f84be782..45d5f72aaf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6615,9 +6615,11 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp,
{
MOVStreamContext *sc = st->priv_data;
int sample, time_sample;
- int i;
+ int i, ret;
+
+ timestamp -= sc->time_offset;
- int ret = mov_seek_fragment(s, st, timestamp);
+ ret = mov_seek_fragment(s, st, timestamp);
if (ret < 0)
return ret;
--
2.13.0
More information about the ffmpeg-devel
mailing list