Index: media/base/audio_renderer_mixer.cc |
diff --git a/media/base/audio_renderer_mixer.cc b/media/base/audio_renderer_mixer.cc |
index b61a04a766eec5504206e05994566473f9e12a60..386703e748211788b7186226ab76accf3afb3ae9 100644 |
--- a/media/base/audio_renderer_mixer.cc |
+++ b/media/base/audio_renderer_mixer.cc |
@@ -54,6 +54,7 @@ AudioRendererMixer::AudioRendererMixer(const AudioParameters& output_params, |
const UmaLogCallback& log_callback) |
: output_params_(output_params), |
audio_sink_(std::move(sink)), |
+ raw_input_(nullptr), |
DaleCurtis
2016/11/01 23:05:13
Why is this necessary? Instead the AudioConverter
AndyWu
2016/11/04 18:04:24
Just took a shortcut, since none of these function
AndyWu
2016/11/04 19:43:48
You are right, the change is not necessary.
|
master_converter_(output_params, output_params, true), |
pause_delay_(base::TimeDelta::FromSeconds(kPauseDelaySeconds)), |
last_play_time_(base::TimeTicks::Now()), |
@@ -84,6 +85,14 @@ void AudioRendererMixer::AddMixerInput(const AudioParameters& input_params, |
audio_sink_->Play(); |
} |
+ if (input_params.IsRawFormat()) { |
+ DCHECK(input); |
+ DCHECK(!raw_input_); |
+ |
+ raw_input_ = input; |
+ return; |
+ } |
+ |
int input_sample_rate = input_params.sample_rate(); |
if (is_master_sample_rate(input_sample_rate)) { |
master_converter_.AddInput(input); |
@@ -115,6 +124,11 @@ void AudioRendererMixer::RemoveMixerInput( |
AudioConverter::InputCallback* input) { |
base::AutoLock auto_lock(lock_); |
+ if (raw_input_ == input) { |
+ raw_input_ = nullptr; |
+ return; |
+ } |
+ |
int input_sample_rate = input_params.sample_rate(); |
if (is_master_sample_rate(input_sample_rate)) { |
master_converter_.RemoveInput(input); |
@@ -168,6 +182,10 @@ int AudioRendererMixer::Render(AudioBus* audio_bus, |
TRACE_EVENT0("audio", "AudioRendererMixer::Render"); |
base::AutoLock auto_lock(lock_); |
+ if (raw_input_) { |
+ return raw_input_->ProvideInput(audio_bus, frames_delayed); |
+ } |
+ |
// If there are no mixer inputs and we haven't seen one for a while, pause the |
// sink to avoid wasting resources when media elements are present but remain |
// in the pause state. |