| Index: content/renderer/media/audio_input_device.cc
|
| diff --git a/content/renderer/media/audio_input_device.cc b/content/renderer/media/audio_input_device.cc
|
| index ce0da67909c755374acfe4540bdaad9ddc862211..d9e694bb10e8425ae0726c33b8eab11314073e91 100644
|
| --- a/content/renderer/media/audio_input_device.cc
|
| +++ b/content/renderer/media/audio_input_device.cc
|
| @@ -11,6 +11,7 @@
|
| #include "content/common/media/audio_messages.h"
|
| #include "content/common/view_messages.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| +#include "media/audio/audio_manager_base.h"
|
| #include "media/audio/audio_util.h"
|
|
|
| AudioInputDevice::AudioInputDevice(size_t buffer_size,
|
| @@ -126,8 +127,9 @@ void AudioInputDevice::InitializeOnIOThread() {
|
| // otherwise it will send a AudioInputHostMsg_StartDevice msg to the browser
|
| // and create the stream when getting a OnDeviceReady() callback.
|
| if (!session_id_) {
|
| - Send(new AudioInputHostMsg_CreateStream(stream_id_, audio_parameters_,
|
| - true));
|
| + Send(new AudioInputHostMsg_CreateStream(
|
| + stream_id_, audio_parameters_, true,
|
| + AudioManagerBase::kDefaultDeviceId));
|
| } else {
|
| Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id_));
|
| pending_device_ready_ = true;
|
| @@ -246,27 +248,28 @@ void AudioInputDevice::OnStateChanged(AudioStreamState state) {
|
| }
|
| }
|
|
|
| -void AudioInputDevice::OnDeviceReady(int index) {
|
| +void AudioInputDevice::OnDeviceReady(const std::string& device_id) {
|
| DCHECK(MessageLoop::current() == ChildProcess::current()->io_message_loop());
|
| - VLOG(1) << "OnDeviceReady (index=" << index << ")";
|
| + VLOG(1) << "OnDeviceReady (device_id=" << device_id << ")";
|
|
|
| // Takes care of the case when Stop() is called before OnDeviceReady().
|
| if (!pending_device_ready_)
|
| return;
|
|
|
| - // -1 means no device has been started.
|
| - if (index == -1) {
|
| + // If AudioInputDeviceManager returns an empty string, it means no device
|
| + // is ready for start.
|
| + if (device_id.empty()) {
|
| filter_->RemoveDelegate(stream_id_);
|
| stream_id_ = 0;
|
| } else {
|
| Send(new AudioInputHostMsg_CreateStream(
|
| - stream_id_, audio_parameters_, true));
|
| + stream_id_, audio_parameters_, true, device_id));
|
| }
|
|
|
| pending_device_ready_ = false;
|
| // Notify the client that the device has been started.
|
| if (event_handler_)
|
| - event_handler_->OnDeviceStarted(index);
|
| + event_handler_->OnDeviceStarted(device_id);
|
| }
|
|
|
| void AudioInputDevice::Send(IPC::Message* message) {
|
|
|