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

Unified Diff: media/base/audio_discard_helper.cc

Issue 2543633006: To M56: Use ffmpeg for opus decoding, no need to maintain our decoder. (Closed)
Patch Set: Created 4 years 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/base/audio_discard_helper.h ('k') | media/base/audio_discard_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_discard_helper.cc
diff --git a/media/base/audio_discard_helper.cc b/media/base/audio_discard_helper.cc
index ee415bf0aad8a6e82d67ee8b222b0af607f8c034..e932c44ab58c43026e5c9208960998c637c7bf0c 100644
--- a/media/base/audio_discard_helper.cc
+++ b/media/base/audio_discard_helper.cc
@@ -22,13 +22,15 @@ static void WarnOnNonMonotonicTimestamps(base::TimeDelta last_timestamp,
<< " diff " << diff.InMicroseconds() << " us";
}
-AudioDiscardHelper::AudioDiscardHelper(int sample_rate, size_t decoder_delay)
+AudioDiscardHelper::AudioDiscardHelper(int sample_rate,
+ size_t decoder_delay,
+ bool delayed_discard)
: sample_rate_(sample_rate),
decoder_delay_(decoder_delay),
timestamp_helper_(sample_rate_),
discard_frames_(0),
last_input_timestamp_(kNoTimestamp),
- delayed_discard_(false),
+ delayed_discard_(delayed_discard),
delayed_end_discard_(0) {
DCHECK_GT(sample_rate_, 0);
}
@@ -45,7 +47,6 @@ void AudioDiscardHelper::Reset(size_t initial_discard) {
discard_frames_ = initial_discard;
last_input_timestamp_ = kNoTimestamp;
timestamp_helper_.SetBaseTimestamp(kNoTimestamp);
- delayed_discard_ = false;
delayed_discard_padding_ = DecoderBuffer::DiscardPadding();
}
@@ -62,8 +63,7 @@ bool AudioDiscardHelper::ProcessBuffers(
last_input_timestamp_ = encoded_buffer->timestamp();
// If this is the first buffer seen, setup the timestamp helper.
- const bool first_buffer = !initialized();
- if (first_buffer) {
+ if (!initialized()) {
// Clamp the base timestamp to zero.
timestamp_helper_.SetBaseTimestamp(
std::max(base::TimeDelta(), encoded_buffer->timestamp()));
@@ -73,10 +73,8 @@ bool AudioDiscardHelper::ProcessBuffers(
if (!decoded_buffer.get()) {
// If there's a one buffer delay for decoding, we need to save it so it can
// be processed with the next decoder buffer.
- if (first_buffer) {
- delayed_discard_ = true;
+ if (delayed_discard_)
delayed_discard_padding_ = encoded_buffer->discard_padding();
- }
return false;
}
« no previous file with comments | « media/base/audio_discard_helper.h ('k') | media/base/audio_discard_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698