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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 2727573005: Remove useless DCHECK; discard helper enforces invalid values. (Closed)
Patch Set: 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/test/pipeline_integration_fuzzertest.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 4d75b7c3861454ef7d03e4a0a2e7c4f07fca8991..cb8e87ed28ef6dcfe3f68690d4aa82b0654d6d4f 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -505,35 +505,25 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
return;
}
- // If enabled, and no codec delay is present, mark audio packets with
- // negative timestamps for post-decode discard.
+ // If enabled, and no codec delay is present, mark audio packets with negative
+ // timestamps for post-decode discard. If codec delay is present, discard is
+ // handled by the decoder using that value.
if (fixup_negative_timestamps_ && is_audio &&
stream_timestamp < base::TimeDelta() &&
- buffer->duration() != kNoTimestamp) {
- if (!audio_decoder_config().codec_delay()) {
- DCHECK_EQ(buffer->discard_padding().first, base::TimeDelta());
-
- if (stream_timestamp + buffer->duration() < base::TimeDelta()) {
- DCHECK_EQ(buffer->discard_padding().second, base::TimeDelta());
-
- // Discard the entire packet if it's entirely before zero.
- buffer->set_discard_padding(
- std::make_pair(kInfiniteDuration, base::TimeDelta()));
- } else {
- // Only discard part of the frame if it overlaps zero.
- buffer->set_discard_padding(std::make_pair(
- -stream_timestamp, buffer->discard_padding().second));
- }
+ buffer->duration() != kNoTimestamp &&
+ !audio_decoder_config().codec_delay()) {
+ DCHECK_EQ(buffer->discard_padding().first, base::TimeDelta());
+
+ if (stream_timestamp + buffer->duration() < base::TimeDelta()) {
+ DCHECK_EQ(buffer->discard_padding().second, base::TimeDelta());
+
+ // Discard the entire packet if it's entirely before zero.
+ buffer->set_discard_padding(
+ std::make_pair(kInfiniteDuration, base::TimeDelta()));
} else {
- // Verify that codec delay would cover discard and that we don't need to
- // mark the packet for post decode discard. Since timestamps may be in
- // milliseconds and codec delay in nanosecond precision, round up to the
- // nearest millisecond. See enable_negative_timestamp_fixups().
- DCHECK_LE(-std::ceil(FramesToTimeDelta(
- audio_decoder_config().codec_delay(),
- audio_decoder_config().samples_per_second())
- .InMillisecondsF()),
- stream_timestamp.InMillisecondsF());
+ // Only discard part of the frame if it overlaps zero.
+ buffer->set_discard_padding(
+ std::make_pair(-stream_timestamp, buffer->discard_padding().second));
}
}
« no previous file with comments | « no previous file | media/test/pipeline_integration_fuzzertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698