| Index: content/renderer/media/renderer_webaudiodevice_impl.cc
|
| diff --git a/content/renderer/media/renderer_webaudiodevice_impl.cc b/content/renderer/media/renderer_webaudiodevice_impl.cc
|
| index 6c366c1f71777690f71c0becb3ec59d80d402f92..c7ae2ec4fb52f56892f2062d7cad47d742e7da82 100644
|
| --- a/content/renderer/media/renderer_webaudiodevice_impl.cc
|
| +++ b/content/renderer/media/renderer_webaudiodevice_impl.cc
|
| @@ -16,7 +16,6 @@
|
| #include "build/build_config.h"
|
| #include "content/renderer/media/audio_device_factory.h"
|
| #include "content/renderer/render_frame_impl.h"
|
| -#include "media/audio/audio_output_device.h"
|
| #include "media/audio/null_audio_sink.h"
|
| #include "media/base/media_switches.h"
|
| #include "third_party/WebKit/public/web/WebLocalFrame.h"
|
| @@ -53,13 +52,13 @@ RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl(
|
| }
|
|
|
| RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() {
|
| - DCHECK(!output_device_);
|
| + DCHECK(!sink_);
|
| }
|
|
|
| void RendererWebAudioDeviceImpl::start() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - if (output_device_)
|
| + if (sink_)
|
| return; // Already started.
|
|
|
| // Assumption: This method is being invoked within a V8 call stack. CHECKs
|
| @@ -72,11 +71,13 @@ void RendererWebAudioDeviceImpl::start() {
|
| WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext();
|
| RenderFrame* const render_frame =
|
| web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL;
|
| - output_device_ = AudioDeviceFactory::NewOutputDevice(
|
| + sink_ = AudioDeviceFactory::NewAudioRendererSink(
|
| + AudioDeviceFactory::kSourceWebAudio,
|
| render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE,
|
| session_id_, std::string(), security_origin_);
|
| - output_device_->Initialize(params_, this);
|
| - output_device_->Start();
|
| + sink_->Initialize(params_, this);
|
| + sink_->Start();
|
| + sink_->Play();
|
| start_null_audio_sink_callback_.Reset(
|
| base::Bind(&media::NullAudioSink::Play, null_audio_sink_));
|
| // Note: Default behavior is to auto-play on start.
|
| @@ -85,9 +86,9 @@ void RendererWebAudioDeviceImpl::start() {
|
| void RendererWebAudioDeviceImpl::stop() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - if (output_device_) {
|
| - output_device_->Stop();
|
| - output_device_ = NULL;
|
| + if (sink_) {
|
| + sink_->Stop();
|
| + sink_ = NULL;
|
| }
|
| null_audio_sink_->Stop();
|
| is_using_null_audio_sink_ = false;
|
| @@ -136,9 +137,9 @@ int RendererWebAudioDeviceImpl::Render(media::AudioBus* dest,
|
| task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&media::NullAudioSink::Pause, null_audio_sink_));
|
| - // Calling output_device_->Play() may trigger reentrancy into this
|
| + // Calling sink_->Play() may trigger reentrancy into this
|
| // function, so this should be called at the end.
|
| - output_device_->Play();
|
| + sink_->Play();
|
| return dest->frames();
|
| }
|
| } else if (!is_using_null_audio_sink_) {
|
| @@ -148,7 +149,7 @@ int RendererWebAudioDeviceImpl::Render(media::AudioBus* dest,
|
| first_silence_time_ = now;
|
| if (now - first_silence_time_
|
| > base::TimeDelta::FromSeconds(kSilenceInSecondsToEnterIdleMode)) {
|
| - output_device_->Pause();
|
| + sink_->Pause();
|
| is_using_null_audio_sink_ = true;
|
| // If Stop() is called right after the task is posted, need to cancel
|
| // this task.
|
|
|