Index: media/filters/ffmpeg_demuxer.cc |
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc |
index e23116f55fedc8d537a3ea7e69b01dc6211f5aa7..a2264dcc8ef895686f4fdd80c941d53ec357a477 100644 |
--- a/media/filters/ffmpeg_demuxer.cc |
+++ b/media/filters/ffmpeg_demuxer.cc |
@@ -278,8 +278,16 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { |
buffer->set_decrypt_config(decrypt_config.Pass()); |
} |
- buffer->set_duration( |
- ConvertStreamTimestamp(stream_->time_base, packet->duration)); |
+ if (packet->duration >= 0) { |
+ buffer->set_duration( |
+ ConvertStreamTimestamp(stream_->time_base, packet->duration)); |
+ } else { |
+ // TODO(wolenetz): Remove when FFmpeg stops returning negative durations. |
+ // https://crbug.com/394418 |
+ DVLOG(1) << "FFmpeg returned a buffer with a negative duration! " |
+ << packet->duration; |
+ buffer->set_duration(kNoTimestamp()); |
+ } |
// Note: If pts is AV_NOPTS_VALUE, stream_timestamp will be kNoTimestamp(). |
const base::TimeDelta stream_timestamp = |