| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/media/audio_output_authorization_handler
.h" | 5 #include "content/browser/renderer_host/media/audio_output_authorization_handler
.h" |
| 6 | 6 |
| 7 #include "base/task_runner_util.h" | 7 #include "base/task_runner_util.h" |
| 8 #include "content/browser/bad_message.h" | 8 #include "content/browser/bad_message.h" |
| 9 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 9 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void AudioOutputAuthorizationHandler::RequestDeviceAuthorization( | 76 void AudioOutputAuthorizationHandler::RequestDeviceAuthorization( |
| 77 int render_frame_id, | 77 int render_frame_id, |
| 78 int session_id, | 78 int session_id, |
| 79 const std::string& device_id, | 79 const std::string& device_id, |
| 80 const url::Origin& security_origin, | 80 const url::Origin& security_origin, |
| 81 AuthorizationCompletedCallback cb) const { | 81 AuthorizationCompletedCallback cb) const { |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 82 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 83 | 83 |
| 84 if (!IsValidDeviceId(device_id)) { | 84 if (!IsValidDeviceId(device_id)) { |
| 85 bad_message::ReceivedBadMessage(render_process_id_, | 85 cb.Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, false, |
| 86 bad_message::AOAH_NONSENSE_DEVICE_ID); | 86 media::AudioParameters::UnavailableDeviceParams(), std::string()); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // If |session_id| should be used for output device selection and such an | 90 // If |session_id| should be used for output device selection and such an |
| 91 // output device is found, reuse the input device permissions. | 91 // output device is found, reuse the input device permissions. |
| 92 if (media::AudioDeviceDescription::UseSessionIdToSelectDevice(session_id, | 92 if (media::AudioDeviceDescription::UseSessionIdToSelectDevice(session_id, |
| 93 device_id)) { | 93 device_id)) { |
| 94 const StreamDeviceInfo* info = | 94 const StreamDeviceInfo* info = |
| 95 media_stream_manager_->audio_input_device_manager() | 95 media_stream_manager_->audio_input_device_manager() |
| 96 ->GetOpenedDeviceInfoById(session_id); | 96 ->GetOpenedDeviceInfoById(session_id); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 215 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 216 DCHECK(!raw_device_id.empty()); | 216 DCHECK(!raw_device_id.empty()); |
| 217 | 217 |
| 218 cb.Run(media::OUTPUT_DEVICE_STATUS_OK, should_send_id, | 218 cb.Run(media::OUTPUT_DEVICE_STATUS_OK, should_send_id, |
| 219 output_params.IsValid() ? output_params | 219 output_params.IsValid() ? output_params |
| 220 : TryToFixAudioParameters(output_params), | 220 : TryToFixAudioParameters(output_params), |
| 221 raw_device_id); | 221 raw_device_id); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace content | 224 } // namespace content |
| OLD | NEW |