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..aa0b8ee9af3390f143351ae2b951bb5d5e787672 100644 |
--- a/content/renderer/media/audio_input_device.cc |
+++ b/content/renderer/media/audio_input_device.cc |
@@ -7,12 +7,15 @@ |
#include "base/bind.h" |
#include "base/message_loop.h" |
#include "base/time.h" |
+#include "content/browser/renderer_host/media/audio_input_device_manager.h" |
#include "content/common/child_process.h" |
#include "content/common/media/audio_messages.h" |
#include "content/common/view_messages.h" |
#include "content/renderer/render_thread_impl.h" |
#include "media/audio/audio_util.h" |
+static const char kDefaultDeviceUId[] = "default"; |
tommi (sloooow) - chröme
2011/11/15 10:29:07
isn't this the definition of the global constant?
no longer working on chromium
2011/11/16 17:47:21
It has been removed.
|
+ |
AudioInputDevice::AudioInputDevice(size_t buffer_size, |
int channels, |
double sample_rate, |
@@ -126,8 +129,10 @@ 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_) { |
+ // Pass an empty string to indicate using default device. |
+ std::string default_device_uid = ""; |
tommi (sloooow) - chröme
2011/11/15 10:29:07
skip the = "" part. (and uid -> id)
no longer working on chromium
2011/11/16 17:47:21
Done.
|
Send(new AudioInputHostMsg_CreateStream(stream_id_, audio_parameters_, |
- true)); |
+ true, default_device_uid)); |
} else { |
Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id_)); |
pending_device_ready_ = true; |
@@ -246,27 +251,26 @@ void AudioInputDevice::OnStateChanged(AudioStreamState state) { |
} |
} |
-void AudioInputDevice::OnDeviceReady(int index) { |
+void AudioInputDevice::OnDeviceReady(const std::string& device_uid) { |
DCHECK(MessageLoop::current() == ChildProcess::current()->io_message_loop()); |
- VLOG(1) << "OnDeviceReady (index=" << index << ")"; |
+ VLOG(1) << "OnDeviceReady (device_uid=" << device_uid << ")"; |
// 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 (device_uid == media_stream::AudioInputDeviceManager::kInvalidDeviceUId) { |
filter_->RemoveDelegate(stream_id_); |
stream_id_ = 0; |
} else { |
Send(new AudioInputHostMsg_CreateStream( |
- stream_id_, audio_parameters_, true)); |
+ stream_id_, audio_parameters_, true, device_uid)); |
} |
pending_device_ready_ = false; |
// Notify the client that the device has been started. |
if (event_handler_) |
- event_handler_->OnDeviceStarted(index); |
+ event_handler_->OnDeviceStarted(device_uid); |
} |
void AudioInputDevice::Send(IPC::Message* message) { |