Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_output_authorization_handler.cc |
| diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler.cc b/content/browser/renderer_host/media/audio_output_authorization_handler.cc |
| index cd9f959e138ceedf9a1b80e994ddebed8c08c2e0..3ed7c30445627901b506246d40efec36a491ad9e 100644 |
| --- a/content/browser/renderer_host/media/audio_output_authorization_handler.cc |
| +++ b/content/browser/renderer_host/media/audio_output_authorization_handler.cc |
| @@ -10,6 +10,7 @@ |
| #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/media_device_id.h" |
| +#include "media/audio/audio_system.h" |
| #include "media/base/limits.h" |
| namespace { |
| @@ -34,26 +35,16 @@ media::AudioParameters TryToFixAudioParameters( |
| : media::AudioParameters::UnavailableDeviceParams(); |
| } |
| -media::AudioParameters GetDeviceParametersOnDeviceThread( |
|
Max Morin
2017/02/14 11:45:45
Very nice that this code goes away. It never belon
o1ka
2017/02/14 12:06:26
Well, not quite. It's just collapsed to one call.
|
| - media::AudioManager* audio_manager, |
| - const std::string& unique_id) { |
| - DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread()); |
| - |
| - return media::AudioDeviceDescription::IsDefaultDevice(unique_id) |
| - ? audio_manager->GetDefaultOutputStreamParameters() |
| - : audio_manager->GetOutputStreamParameters(unique_id); |
| -} |
| - |
| } // namespace |
| namespace content { |
| AudioOutputAuthorizationHandler::AudioOutputAuthorizationHandler( |
| - media::AudioManager* audio_manager, |
| + media::AudioSystem* audio_system, |
| MediaStreamManager* media_stream_manager, |
| int render_process_id, |
| const std::string& salt) |
| - : audio_manager_(audio_manager), |
| + : audio_system_(audio_system), |
| media_stream_manager_(media_stream_manager), |
| permission_checker_(base::MakeUnique<MediaDevicesPermissionChecker>()), |
| render_process_id_(render_process_id), |
| @@ -191,18 +182,8 @@ void AudioOutputAuthorizationHandler::GetDeviceParameters( |
| const std::string& raw_device_id) const { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| DCHECK(!raw_device_id.empty()); |
| - base::PostTaskAndReplyWithResult( |
| - // Note: In the case of a shutdown, the task to delete |audio_manager_| is |
| - // posted to the audio thread after the IO thread is stopped, so the task |
| - // to delete the audio manager hasn't been posted yet. This means that |
| - // unretained is safe here. |
| - // Mac is a special case. Since the audio manager lives on the UI thread |
| - // on Mac, this task is posted to the UI thread, but tasks posted to the |
| - // UI task runner will be ignored when the shutdown has progressed to |
| - // deleting the audio manager, so this is still safe. |
| - audio_manager_->GetTaskRunner(), FROM_HERE, |
| - base::Bind(&GetDeviceParametersOnDeviceThread, |
| - base::Unretained(audio_manager_), raw_device_id), |
| + audio_system_->GetOutputStreamParameters( |
| + raw_device_id, |
| base::Bind(&AudioOutputAuthorizationHandler::DeviceParametersReceived, |
| weak_factory_.GetWeakPtr(), std::move(cb), false, |
| raw_device_id)); |