diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-14 22:52:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-14 22:52:42 +0100 |
| commit | b6aa4eaa6e4335c3b5a7144c0ab126eb8dbe94ec (patch) | |
| tree | e4cdda02f42c9ef4a07cbd39192075c45ff6020f /src/lib/ffmpeg_decoder.cc | |
| parent | b19fed96652628c7d5c397bdc797b8717afeb44b (diff) | |
Don't seek before 0 in FFmpegDecoder; fixes errors on seek close to 0.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index f8152b56e..4ca06329b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -315,7 +315,10 @@ FFmpegDecoder::seek (ContentTime time, bool accurate) http://www.mjbshaw.com/2012/04/seeking-in-ffmpeg-know-your-timestamp.html */ - ContentTime const u = time - _pts_offset; + ContentTime u = time - _pts_offset; + if (u < ContentTime ()) { + u = ContentTime (); + } av_seek_frame (_format_context, _video_stream, u.seconds() / av_q2d (_format_context->streams[_video_stream]->time_base), AVSEEK_FLAG_BACKWARD); avcodec_flush_buffers (video_codec_context()); |
