| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/audio/audio_output_device.h" | 5 #include "media/audio/audio_output_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 OutputDeviceInfo AudioOutputDevice::GetOutputDeviceInfo() { | 143 OutputDeviceInfo AudioOutputDevice::GetOutputDeviceInfo() { |
| 144 CHECK(!task_runner()->BelongsToCurrentThread()); | 144 CHECK(!task_runner()->BelongsToCurrentThread()); |
| 145 did_receive_auth_.Wait(); | 145 did_receive_auth_.Wait(); |
| 146 return OutputDeviceInfo(AudioDeviceDescription::UseSessionIdToSelectDevice( | 146 return OutputDeviceInfo(AudioDeviceDescription::UseSessionIdToSelectDevice( |
| 147 session_id_, device_id_) | 147 session_id_, device_id_) |
| 148 ? matched_device_id_ | 148 ? matched_device_id_ |
| 149 : device_id_, | 149 : device_id_, |
| 150 device_status_, output_params_); | 150 device_status_, output_params_); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool AudioOutputDevice::BelongsToRenderingThread() { |
| 154 return audio_thread_.BelongsToRenderingThread(); |
| 155 } |
| 156 |
| 153 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { | 157 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { |
| 154 DCHECK(task_runner()->BelongsToCurrentThread()); | 158 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 155 DCHECK_EQ(state_, IDLE); | 159 DCHECK_EQ(state_, IDLE); |
| 156 state_ = AUTHORIZING; | 160 state_ = AUTHORIZING; |
| 157 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, | 161 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, |
| 158 security_origin_); | 162 security_origin_); |
| 159 } | 163 } |
| 160 | 164 |
| 161 void AudioOutputDevice::CreateStreamOnIOThread(const AudioParameters& params) { | 165 void AudioOutputDevice::CreateStreamOnIOThread(const AudioParameters& params) { |
| 162 DCHECK(task_runner()->BelongsToCurrentThread()); | 166 DCHECK(task_runner()->BelongsToCurrentThread()); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 448 |
| 445 // Update the audio-delay measurement, inform about the number of skipped | 449 // Update the audio-delay measurement, inform about the number of skipped |
| 446 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 450 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
| 447 // the shared memory the Render() call is writing directly into the shared | 451 // the shared memory the Render() call is writing directly into the shared |
| 448 // memory. | 452 // memory. |
| 449 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 453 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
| 450 frames_skipped); | 454 frames_skipped); |
| 451 } | 455 } |
| 452 | 456 |
| 453 } // namespace media | 457 } // namespace media |
| OLD | NEW |