Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_input_device_manager.cc |
| diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc |
| index 33d0bfd244cdc64b894adf7de2264ac9f227692c..9506814a486ab5f2b8b30083d377d149f1f4a4d0 100644 |
| --- a/content/browser/renderer_host/media/audio_input_device_manager.cc |
| +++ b/content/browser/renderer_host/media/audio_input_device_manager.cc |
| @@ -8,7 +8,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h" |
| #include "content/public/browser/browser_thread.h" |
| -#include "media/audio/audio_manager.h" |
| +#include "media/audio/audio_manager_base.h" |
| using content::BrowserThread; |
| @@ -16,8 +16,7 @@ namespace media_stream { |
| const int AudioInputDeviceManager::kFakeOpenSessionId = 1; |
| const int AudioInputDeviceManager::kInvalidSessionId = 0; |
| -const int AudioInputDeviceManager::kInvalidDevice = -1; |
| -const int AudioInputDeviceManager::kDefaultDeviceIndex = 0; |
| +const char AudioInputDeviceManager::kInvalidDeviceUId[] = ""; |
| // Starting id for the first capture session. |
| const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1; |
| @@ -111,14 +110,15 @@ void AudioInputDeviceManager::Start( |
| // And we do not store the info for the kFakeOpenSessionId but return |
| // the callback immediately. |
| if (session_id == kFakeOpenSessionId) { |
| - event_handler->OnDeviceStarted(session_id, kDefaultDeviceIndex); |
| + event_handler->OnDeviceStarted(session_id, |
| + AudioManagerBase::kDefaultDeviceId); |
|
henrika (OOO until Aug 14)
2011/11/16 13:24:02
We mix UId and Id here. Not sure why?
no longer working on chromium
2011/11/16 17:45:48
When it is kFakeOpenSessionId, which is 1, then we
|
| return; |
| } |
| // If session has been started, post a callback with an error. |
| if (event_handlers_.find(session_id) != event_handlers_.end()) { |
| // Session has been started, post a callback with error. |
| - event_handler->OnDeviceStarted(session_id, kInvalidDevice); |
| + event_handler->OnDeviceStarted(session_id, kInvalidDeviceUId); |
| return; |
| } |
| @@ -205,7 +205,7 @@ void AudioInputDeviceManager::StartOnDeviceThread(const int session_id) { |
| // Get the up-to-date device enumeration list from the system and find out |
|
henrika (OOO until Aug 14)
2011/11/16 13:24:02
I really hate fuzzy phrases like "the system" ;-(
no longer working on chromium
2011/11/16 17:45:48
Done.
|
| // the index of the device. |
|
henrika (OOO until Aug 14)
2011/11/16 13:24:02
This comment is old.
no longer working on chromium
2011/11/16 17:45:48
Done.
|
| - int device_index = kInvalidDevice; |
| + std::string device_uid = kInvalidDeviceUId; |
| AudioInputDeviceMap::const_iterator it = devices_.find(session_id); |
| if (it != devices_.end()) { |
| media::AudioDeviceNames device_names; |
| @@ -218,7 +218,7 @@ void AudioInputDeviceManager::StartOnDeviceThread(const int session_id) { |
| if (iter->device_name == it->second.device_name && |
| iter->unique_id == it->second.unique_id) { |
| // Found the device. |
| - device_index = index; |
| + device_uid = iter->unique_id; |
| break; |
| } |
| } |
| @@ -231,7 +231,7 @@ void AudioInputDeviceManager::StartOnDeviceThread(const int session_id) { |
| &AudioInputDeviceManager::StartedOnIOThread, |
| base::Unretained(this), |
| session_id, |
| - device_index)); |
| + device_uid)); |
| } |
| void AudioInputDeviceManager::StopOnDeviceThread(int session_id) { |
| @@ -276,7 +276,8 @@ void AudioInputDeviceManager::ErrorOnIOThread(int session_id, |
| listener_->Error(kAudioCapture, session_id, error); |
| } |
| -void AudioInputDeviceManager::StartedOnIOThread(int session_id, int index) { |
| +void AudioInputDeviceManager::StartedOnIOThread( |
| + int session_id, const std::string& device_uid) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| EventHandlerMap::iterator it = event_handlers_.find(session_id); |
| @@ -284,7 +285,7 @@ void AudioInputDeviceManager::StartedOnIOThread(int session_id, int index) { |
| return; |
| // Post a callback through the event handler to create an audio stream. |
|
henrika (OOO until Aug 14)
2011/11/16 13:24:02
Please add more info here about what is the next s
no longer working on chromium
2011/11/16 17:45:48
Done.
|
| - it->second->OnDeviceStarted(session_id, index); |
| + it->second->OnDeviceStarted(session_id, device_uid); |
| } |
| void AudioInputDeviceManager::StoppedOnIOThread(int session_id) { |