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

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 239423005: Wire up codec_delay() to MP3StreamParser and FFmpegAudioDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch codec_delay() to frames. Created 6 years, 8 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
Index: media/filters/ffmpeg_audio_decoder.cc
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 45f8dd4863d6da11db8b4792ee5dba86c4551948..a7500136df058967600dbfa30102681d4803ef8f 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -267,8 +267,8 @@ void FFmpegAudioDecoder::DecodeBuffer(
buffer->timestamp() < base::TimeDelta()) {
// Dropping frames for negative timestamps as outlined in section A.2
// in the Vorbis spec. http://xiph.org/vorbis/doc/Vorbis_I_spec.html
- output_frames_to_drop_ = floor(0.5 + -buffer->timestamp().InSecondsF() *
acolwell GONE FROM CHROMIUM 2014/04/17 21:11:24 Why is this change needed?
DaleCurtis 2014/04/17 21:42:49 It's a cleanup from an earlier patch set. I kept
- config_.samples_per_second());
+ output_frames_to_drop_ = 0.5 + -buffer->timestamp().InSecondsF() *
+ config_.samples_per_second();
} else {
if (last_input_timestamp_ != kNoTimestamp() &&
buffer->timestamp() < last_input_timestamp_) {
@@ -358,10 +358,10 @@ bool FFmpegAudioDecoder::FFmpegDecode(
if (output_timestamp_helper_->base_timestamp() == kNoTimestamp() &&
!buffer->end_of_stream()) {
DCHECK(buffer->timestamp() != kNoTimestamp());
- if (output_frames_to_drop_ > 0) {
- // Currently Vorbis is the only codec that causes us to drop samples.
- // If we have to drop samples it always means the timeline starts at 0.
- DCHECK_EQ(codec_context_->codec_id, AV_CODEC_ID_VORBIS);
+ if (output_frames_to_drop_ > 0 &&
+ codec_context_->codec_id == AV_CODEC_ID_VORBIS) {
+ // If we are dropping samples for Vorbis, it always means the timeline
+ // starts at 0.
output_timestamp_helper_->SetBaseTimestamp(base::TimeDelta());
acolwell GONE FROM CHROMIUM 2014/04/17 21:11:24 Can we move this up into DecodeBuffer() next to th
DaleCurtis 2014/04/17 21:42:49 Done.
} else {
output_timestamp_helper_->SetBaseTimestamp(buffer->timestamp());
@@ -496,6 +496,8 @@ bool FFmpegAudioDecoder::ConfigureDecoder() {
state_ = kUninitialized;
return false;
}
+
+ output_frames_to_drop_ = config_.codec_delay();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698