Commit 7ef29df1 authored by sandersd's avatar sandersd Committed by Commit bot

Media: Reject negative initial timestamps in FFmpegDemuxer.

During recent changes, it became possible for the first video buffer
timestamp in a stream to be negative. This change restores the invariant
that video buffer timestampes are non-negative, by emitting a demuxer
error in this case.

BUG=710845

Review-Url: https://codereview.chromium.org/2822063002
Cr-Commit-Position: refs/heads/master@{#465678}
parent dfd089f1
...@@ -507,7 +507,8 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { ...@@ -507,7 +507,8 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
// Only allow negative timestamps past if we know they'll be fixed up by the // 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. // code paths below; otherwise they should be treated as a parse error.
if (!fixup_negative_timestamps_ && buffer->timestamp() < base::TimeDelta()) { if ((!fixup_negative_timestamps_ || last_packet_timestamp_ == kNoTimestamp) &&
buffer->timestamp() < base::TimeDelta()) {
MEDIA_LOG(DEBUG, media_log_) MEDIA_LOG(DEBUG, media_log_)
<< "FFmpegDemuxer: unfixable negative timestamp"; << "FFmpegDemuxer: unfixable negative timestamp";
demuxer_->NotifyDemuxerError(DEMUXER_ERROR_COULD_NOT_PARSE); demuxer_->NotifyDemuxerError(DEMUXER_ERROR_COULD_NOT_PARSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment