Chromium Code Reviews| 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..7a6624ad1ab4856d525261b3d9eabbf14740dd79 100644 |
| --- a/content/renderer/media/audio_input_device.cc |
| +++ b/content/renderer/media/audio_input_device.cc |
| @@ -11,8 +11,10 @@ |
| #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" |
|
jam
2011/11/21 16:39:23
nit: extra line
no longer working on chromium
2011/11/21 16:47:56
Done.
|
| + |
| AudioInputDevice::AudioInputDevice(size_t buffer_size, |
| int channels, |
| double sample_rate, |
| @@ -126,8 +128,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_) { |
| + std::string device_id = AudioManagerBase::kDefaultDeviceId; |
| Send(new AudioInputHostMsg_CreateStream(stream_id_, audio_parameters_, |
| - true)); |
| + true, device_id)); |
| } else { |
| Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id_)); |
| pending_device_ready_ = true; |
| @@ -246,27 +249,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) { |