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

Unified Diff: media/base/audio_converter.cc

Issue 14358049: Refactor AudioRendererMixer to be more generic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 7 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/base/audio_converter.h ('k') | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_converter.cc
diff --git a/media/base/audio_converter.cc b/media/base/audio_converter.cc
index 6434ee9142411de9bc6d5d42bf435f210f0d75fa..7ffc9aea4a83e28fcc6bf662ecc965500d62518c 100644
--- a/media/base/audio_converter.cc
+++ b/media/base/audio_converter.cc
@@ -117,7 +117,10 @@ void AudioConverter::Reset() {
resampler_->Flush();
}
-void AudioConverter::Convert(AudioBus* dest) {
+void AudioConverter::ConvertWithDelay(const base::TimeDelta& initial_delay,
+ AudioBus* dest) {
+ initial_delay_ = initial_delay;
+
if (transform_inputs_.empty()) {
dest->Zero();
return;
@@ -150,6 +153,10 @@ void AudioConverter::Convert(AudioBus* dest) {
}
}
+void AudioConverter::Convert(AudioBus* dest) {
+ ConvertWithDelay(base::TimeDelta::FromMilliseconds(0), dest);
+}
+
void AudioConverter::SourceCallback(int fifo_frame_delay, AudioBus* dest) {
bool needs_downmix = channel_mixer_ && downmix_early_;
@@ -174,7 +181,7 @@ void AudioConverter::SourceCallback(int fifo_frame_delay, AudioBus* dest) {
DCHECK_EQ(temp_dest->channels(), mixer_input_audio_bus_->channels());
// Calculate the buffer delay for this callback.
- base::TimeDelta buffer_delay;
+ base::TimeDelta buffer_delay = initial_delay_;
if (resampler_) {
buffer_delay += base::TimeDelta::FromMicroseconds(
resampler_frame_delay_ * output_frame_duration_.InMicroseconds());
« no previous file with comments | « media/base/audio_converter.h ('k') | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698