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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 2699563002: Issue a parse error on unexpected negative timestamps. (Closed)
Patch Set: Rebase. Created 3 years, 10 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 | « no previous file | media/filters/ffmpeg_demuxer_unittest.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 893e16ad18b487975cc63450e3589daad74fd96b..8dc42a76ff60f9d121ca48fa7383e304b2ff8c87 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -498,6 +498,13 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
buffer->set_timestamp(stream_timestamp - start_time);
+ // Only allow negative timestamps past if we know they'll be fixed up by the
+ // code paths below; otherwise they should be treated as a parse error.
+ if (!fixup_negative_timestamps_ && buffer->timestamp() < base::TimeDelta()) {
+ demuxer_->NotifyDemuxerError(DEMUXER_ERROR_COULD_NOT_PARSE);
+ return;
+ }
+
// If enabled, and no codec delay is present, mark audio packets with
// negative timestamps for post-decode discard.
if (fixup_negative_timestamps_ && is_audio &&
@@ -552,7 +559,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
}
// The demuxer should always output positive timestamps.
- DCHECK(buffer->timestamp() >= base::TimeDelta());
+ DCHECK_GE(buffer->timestamp(), base::TimeDelta());
if (last_packet_timestamp_ < buffer->timestamp()) {
buffered_ranges_.Add(last_packet_timestamp_, buffer->timestamp());
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698