Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1245)

Unified Diff: content/renderer/media/audio_input_device.cc

Issue 8491044: Link things together and enable the device selection for linux and mac. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fixing unittests Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..80a84150f4f2f3f944e87c1c89b1066e545dce3f 100644
--- a/content/renderer/media/audio_input_device.cc
+++ b/content/renderer/media/audio_input_device.cc
@@ -13,6 +13,8 @@
#include "content/renderer/render_thread_impl.h"
#include "media/audio/audio_util.h"
+static const char kDefaultDeviceUId[] = "default";
scherkus (not reviewing) 2011/11/16 01:20:40 I don't see this used and it's also confusing with
no longer working on chromium 2011/11/16 17:45:48 Sorry, wrong code by mistake.
+
AudioInputDevice::AudioInputDevice(size_t buffer_size,
int channels,
double sample_rate,
@@ -126,8 +128,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 = "";
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 +250,28 @@ 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 AudioInputDeviceManager returns an empty string, it means no device
+ // is ready for start.
+ if (device_uid.empty()) {
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) {

Powered by Google App Engine
This is Rietveld 408576698