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

Unified Diff: media/filters/opus_audio_decoder.cc

Issue 257563007: Don't double correct for discarded codec delay frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test everything. 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
« no previous file with comments | « media/filters/audio_file_reader.cc ('k') | media/filters/opus_audio_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/opus_audio_decoder.cc
diff --git a/media/filters/opus_audio_decoder.cc b/media/filters/opus_audio_decoder.cc
index e54bf08f502657478d362eb4593eabcb0d2e8aef..a92752a0734c18fe99d657dc8a9d87eaf6d0f3c4 100644
--- a/media/filters/opus_audio_decoder.cc
+++ b/media/filters/opus_audio_decoder.cc
@@ -289,6 +289,9 @@ void OpusAudioDecoder::Reset(const base::Closure& closure) {
void OpusAudioDecoder::Stop() {
DCHECK(task_runner_->BelongsToCurrentThread());
+ if (!opus_decoder_)
+ return;
+
opus_multistream_decoder_ctl(opus_decoder_, OPUS_RESET_STATE);
ResetTimestampState();
CloseDecoder();
@@ -398,7 +401,8 @@ bool OpusAudioDecoder::ConfigureDecoder() {
if (config_.codec_delay() != opus_extra_data.skip_samples) {
DLOG(ERROR) << "Invalid file. Codec Delay in container does not match the "
- << "value in Opus Extra Data.";
+ << "value in Opus Extra Data. " << config_.codec_delay()
+ << " vs " << opus_extra_data.skip_samples;
return false;
}
@@ -491,12 +495,7 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input,
if (output_timestamp_helper_->base_timestamp() == kNoTimestamp() &&
!input->end_of_stream()) {
DCHECK(input->timestamp() != kNoTimestamp());
- // Adjust the timestamp helper so the base timestamp is corrected for frames
- // dropped due to codec delay.
output_timestamp_helper_->SetBaseTimestamp(input->timestamp());
- output_timestamp_helper_->SetBaseTimestamp(
- input->timestamp() -
- output_timestamp_helper_->GetFrameDuration(config_.codec_delay()));
}
// Trim off any extraneous allocation.
@@ -532,7 +531,7 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input,
output_buffer->get()->set_timestamp(output_timestamp_helper_->GetTimestamp());
output_buffer->get()->set_duration(
output_timestamp_helper_->GetFrameDuration(frames_to_output));
- output_timestamp_helper_->AddFrames(frames_decoded);
+ output_timestamp_helper_->AddFrames(frames_to_output);
DaleCurtis 2014/04/25 18:23:12 This is already fixed in https://codereview.chromi
// Discard the buffer to indicate we need more data.
if (!frames_to_output)
« no previous file with comments | « media/filters/audio_file_reader.cc ('k') | media/filters/opus_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698