Chromium Code Reviews| Index: media/audio/audio_output_device.cc |
| diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc |
| index 7044e9ae770649c0477b9b37af56eca6fff01abb..5ba556578de7bca6207186af63504de4e6b081a4 100644 |
| --- a/media/audio/audio_output_device.cc |
| +++ b/media/audio/audio_output_device.cc |
| @@ -293,7 +293,8 @@ void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegateState state) { |
| void AudioOutputDevice::OnDeviceAuthorized( |
| OutputDeviceStatus device_status, |
| - const media::AudioParameters& output_params) { |
| + const media::AudioParameters& output_params, |
| + const std::string& matched_device_id) { |
| DCHECK(task_runner()->BelongsToCurrentThread()); |
| DCHECK_EQ(state_, AUTHORIZING); |
| @@ -316,6 +317,14 @@ void AudioOutputDevice::OnDeviceAuthorized( |
| } |
| if (start_on_authorized_) |
| CreateStreamOnIOThread(audio_parameters_); |
| + |
| + // Matching can take place only if |session_id_| is specified and |
| + // |device_id_| is not, however, it's possible not to have a matched device |
| + // even in this case. It means |session_id_| failed and the default device |
|
Henrik Grunell
2016/03/08 21:09:57
What does "|session_id_| failed" mean?
o1ka
2016/04/05 15:13:38
Done.
|
| + // is used. |
| + DCHECK((session_id_ && device_id_.empty()) ? true |
| + : matched_device_id_.empty()); |
| + matched_device_id_ = matched_device_id; |
|
o1ka
2016/04/05 15:13:38
This races with a getter: |matched_device_id_| sho
|
| } else { |
| // Closing IPC forces a Signal(), so no clients are locked waiting |
| // indefinitely after this method returns. |
| @@ -387,6 +396,12 @@ void AudioOutputDevice::WillDestroyCurrentMessageLoop() { |
| ShutDownOnIOThread(); |
| } |
| +std::string AudioOutputDevice::GetDeviceId() { |
| + CHECK(!task_runner()->BelongsToCurrentThread()); |
| + did_receive_auth_.Wait(); |
| + return (device_id_.empty() && session_id_) ? matched_device_id_ : device_id_; |
| +} |
| + |
| // AudioOutputDevice::AudioThreadCallback |
| AudioOutputDevice::AudioThreadCallback::AudioThreadCallback( |