Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 393403002: Update SourceBufferStream and its unit tests to always expect valid durations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/stream_parser_buffer.cc ('k') | media/filters/source_buffer_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « media/base/stream_parser_buffer.cc ('k') | media/filters/source_buffer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698