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

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: rebase2 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
« no previous file with comments | « content/renderer/media/audio_input_device.h ('k') | content/renderer/media/audio_input_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/renderer/media/audio_input_device.h ('k') | content/renderer/media/audio_input_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698