diff options
author | Max Kellermann <max@duempel.org> | 2014-12-11 10:50:20 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-15 00:40:46 +0100 |
commit | fa4beeee75f6f4a8377d6fb2ab0844b8b7105840 (patch) | |
tree | c1bf9bcebcce973bbae1f85f2e6dc6ed550ed3ff | |
parent | d8351772d38aff7c40a28ba799af68950b8b7323 (diff) | |
download | mpd-fa4beeee75f6f4a8377d6fb2ab0844b8b7105840.tar.gz mpd-fa4beeee75f6f4a8377d6fb2ab0844b8b7105840.tar.xz mpd-fa4beeee75f6f4a8377d6fb2ab0844b8b7105840.zip |
decoder/ffmpeg: detect and fix negative time stamps
Works around assertion failure due to something that appears to be a
(minor) FFmpeg bug.
Diffstat (limited to '')
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/decoder/FfmpegDecoderPlugin.cxx | 11 |
2 files changed, 9 insertions, 4 deletions
@@ -1,4 +1,6 @@ ver 0.18.21 (not yet released) +* decoder + - ffmpeg: fix time stamp underflow ver 0.18.20 (2014/12/08) * decoder diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index 8a0937903..9a00bf3c4 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -284,10 +284,13 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, AVFrame *frame, uint8_t **buffer, int *buffer_size) { - if (packet->pts >= 0 && packet->pts != (int64_t)AV_NOPTS_VALUE) - decoder_timestamp(decoder, - time_from_ffmpeg(packet->pts - start_time_fallback(*stream), - stream->time_base)); + if (packet->pts >= 0 && packet->pts != (int64_t)AV_NOPTS_VALUE) { + auto start = start_time_fallback(*stream); + if (packet->pts >= start) + decoder_timestamp(decoder, + time_from_ffmpeg(packet->pts - start, + stream->time_base)); + } AVPacket packet2 = *packet; |