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

Unified Diff: trunk/src/media/filters/opus_audio_decoder.cc

Issue 242203006: Revert 264763 "Wire up codec_delay() to MP3StreamParser and FFmp..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | « trunk/src/media/filters/opus_audio_decoder.h ('k') | trunk/src/media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/media/filters/opus_audio_decoder.cc
===================================================================
--- trunk/src/media/filters/opus_audio_decoder.cc (revision 264802)
+++ trunk/src/media/filters/opus_audio_decoder.cc (working copy)
@@ -253,6 +253,7 @@
opus_decoder_(NULL),
last_input_timestamp_(kNoTimestamp()),
frames_to_discard_(0),
+ frame_delay_at_start_(0),
start_input_timestamp_(kNoTimestamp()) {}
void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config,
@@ -336,7 +337,7 @@
start_input_timestamp_ = input->timestamp();
if (last_input_timestamp_ == kNoTimestamp() &&
input->timestamp() == start_input_timestamp_) {
- frames_to_discard_ = config_.codec_delay();
+ frames_to_discard_ = frame_delay_at_start_;
}
last_input_timestamp_ = input->timestamp();
@@ -390,13 +391,17 @@
&opus_extra_data))
return false;
- if (config_.codec_delay() <= 0) {
+ // Convert from seconds to samples.
+ timestamp_offset_ = config_.codec_delay();
+ frame_delay_at_start_ = TimeDeltaToAudioFrames(config_.codec_delay(),
+ config_.samples_per_second());
+ if (timestamp_offset_ <= base::TimeDelta() || frame_delay_at_start_ < 0) {
DLOG(ERROR) << "Invalid file. Incorrect value for codec delay: "
- << config_.codec_delay();
+ << config_.codec_delay().InMicroseconds();
return false;
}
- if (config_.codec_delay() != opus_extra_data.skip_samples) {
+ if (frame_delay_at_start_ != opus_extra_data.skip_samples) {
DLOG(ERROR) << "Invalid file. Codec Delay in container does not match the "
<< "value in Opus Extra Data.";
return false;
@@ -491,12 +496,7 @@
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.
@@ -529,7 +529,8 @@
}
// Assign timestamp and duration to the buffer.
- output_buffer->get()->set_timestamp(output_timestamp_helper_->GetTimestamp());
+ output_buffer->get()->set_timestamp(
+ output_timestamp_helper_->GetTimestamp() - timestamp_offset_);
output_buffer->get()->set_duration(
output_timestamp_helper_->GetFrameDuration(frames_to_output));
output_timestamp_helper_->AddFrames(frames_decoded);
« no previous file with comments | « trunk/src/media/filters/opus_audio_decoder.h ('k') | trunk/src/media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698