summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorJonas Licht <jonas.licht@fem.tu-ilmenau.de>2017-10-29 12:11:39 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-10-30 01:09:40 +0100
commit59ad504696958fbd9db7b478b4b7e0a2b436b7f2 (patch)
treef3ded368911b57a1f20479151bbf0f06c8df12ae /libavformat
parentd3f1b0d3d87f782d6a89a73c57e8be992d4785da (diff)
libavformat/mov.c: use calculated dts offset when seeking in streams
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@fem.tu-ilmenau.de> Signed-off-by: Peter Große <pegro@friiks.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 209b7470a9..60f0228e2d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6901,10 +6901,12 @@ static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
{
MOVStreamContext *sc = st->priv_data;
- int sample, time_sample;
+ int sample, time_sample, ret;
unsigned int i;
- int ret = mov_seek_fragment(s, st, timestamp);
+ timestamp -= sc->time_offset;
+
+ ret = mov_seek_fragment(s, st, timestamp);
if (ret < 0)
return ret;