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

Unified Diff: media/filters/opus_audio_decoder.cc

Issue 1260193005: Fix incorrect opus seek preroll and flaky pre-skip removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mojo renderer. Created 5 years, 4 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/opus_audio_decoder.h ('k') | media/test/data/opus-trimming-test.ogg » ('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 181f34014da4f0b9b011c1381b94a886440154e8..abfa13b27f74eae51461ce6eb63ec13b6c61a866 100644
--- a/media/filters/opus_audio_decoder.cc
+++ b/media/filters/opus_audio_decoder.cc
@@ -245,9 +245,7 @@ static bool ParseOpusExtraData(const uint8* data, int data_size,
OpusAudioDecoder::OpusAudioDecoder(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
- : task_runner_(task_runner),
- opus_decoder_(NULL),
- start_input_timestamp_(kNoTimestamp()) {}
+ : task_runner_(task_runner), opus_decoder_(nullptr) {}
std::string OpusAudioDecoder::GetDisplayName() const {
return "OpusAudioDecoder";
@@ -293,7 +291,6 @@ OpusAudioDecoder::~OpusAudioDecoder() {
return;
opus_multistream_decoder_ctl(opus_decoder_, OPUS_RESET_STATE);
- ResetTimestampState();
CloseDecoder();
}
@@ -319,14 +316,6 @@ void OpusAudioDecoder::DecodeBuffer(
return;
}
- // Apply the necessary codec delay.
- if (start_input_timestamp_ == kNoTimestamp())
- start_input_timestamp_ = input->timestamp();
- if (!discard_helper_->initialized() &&
- input->timestamp() == start_input_timestamp_) {
- discard_helper_->Reset(config_.codec_delay());
- }
-
scoped_refptr<AudioBuffer> output_buffer;
if (!Decode(input, &output_buffer)) {
@@ -420,22 +409,21 @@ bool OpusAudioDecoder::ConfigureDecoder() {
return false;
}
- discard_helper_.reset(
- new AudioDiscardHelper(config_.samples_per_second(), 0));
- start_input_timestamp_ = kNoTimestamp();
+ ResetTimestampState();
return true;
}
void OpusAudioDecoder::CloseDecoder() {
if (opus_decoder_) {
opus_multistream_decoder_destroy(opus_decoder_);
- opus_decoder_ = NULL;
+ opus_decoder_ = nullptr;
}
}
void OpusAudioDecoder::ResetTimestampState() {
- discard_helper_->Reset(
- discard_helper_->TimeDeltaToFrames(config_.seek_preroll()));
+ discard_helper_.reset(
+ new AudioDiscardHelper(config_.samples_per_second(), 0));
+ discard_helper_->Reset(config_.codec_delay());
}
bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input,
@@ -479,7 +467,7 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input,
// Handles discards and timestamping. Discard the buffer if more data needed.
if (!discard_helper_->ProcessBuffers(input, *output_buffer))
- *output_buffer = NULL;
+ *output_buffer = nullptr;
return true;
}
« no previous file with comments | « media/filters/opus_audio_decoder.h ('k') | media/test/data/opus-trimming-test.ogg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698