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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 OutputDevice* AudioOutputDevice::GetOutputDevice() { | 141 OutputDevice* AudioOutputDevice::GetOutputDevice() { |
142 return this; | 142 return this; |
143 } | 143 } |
144 | 144 |
145 void AudioOutputDevice::SwitchOutputDevice( | |
146 const std::string& device_id, | |
147 const url::Origin& security_origin, | |
148 const SwitchOutputDeviceCB& callback) { | |
149 NOTREACHED(); | |
150 } | |
151 | |
152 AudioParameters AudioOutputDevice::GetOutputParameters() { | 145 AudioParameters AudioOutputDevice::GetOutputParameters() { |
153 CHECK(!task_runner()->BelongsToCurrentThread()); | 146 CHECK(!task_runner()->BelongsToCurrentThread()); |
154 did_receive_auth_.Wait(); | 147 did_receive_auth_.Wait(); |
155 return output_params_; | 148 return output_params_; |
156 } | 149 } |
157 | 150 |
158 OutputDeviceStatus AudioOutputDevice::GetDeviceStatus() { | 151 OutputDeviceStatus AudioOutputDevice::GetDeviceStatus() { |
159 CHECK(!task_runner()->BelongsToCurrentThread()); | 152 CHECK(!task_runner()->BelongsToCurrentThread()); |
160 did_receive_auth_.Wait(); | 153 did_receive_auth_.Wait(); |
161 return device_status_; | 154 return device_status_; |
162 } | 155 } |
163 | 156 |
| 157 std::string AudioOutputDevice::GetDeviceId() { |
| 158 CHECK(!task_runner()->BelongsToCurrentThread()); |
| 159 did_receive_auth_.Wait(); |
| 160 return device_id_; |
| 161 } |
| 162 |
164 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { | 163 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { |
165 DCHECK(task_runner()->BelongsToCurrentThread()); | 164 DCHECK(task_runner()->BelongsToCurrentThread()); |
166 DCHECK_EQ(state_, IDLE); | 165 DCHECK_EQ(state_, IDLE); |
167 state_ = AUTHORIZING; | 166 state_ = AUTHORIZING; |
168 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, | 167 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, |
169 security_origin_); | 168 security_origin_); |
170 } | 169 } |
171 | 170 |
172 void AudioOutputDevice::CreateStreamOnIOThread(const AudioParameters& params) { | 171 void AudioOutputDevice::CreateStreamOnIOThread(const AudioParameters& params) { |
173 DCHECK(task_runner()->BelongsToCurrentThread()); | 172 DCHECK(task_runner()->BelongsToCurrentThread()); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 440 |
442 // Update the audio-delay measurement, inform about the number of skipped | 441 // Update the audio-delay measurement, inform about the number of skipped |
443 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 442 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
444 // the shared memory the Render() call is writing directly into the shared | 443 // the shared memory the Render() call is writing directly into the shared |
445 // memory. | 444 // memory. |
446 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 445 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
447 frames_skipped); | 446 frames_skipped); |
448 } | 447 } |
449 | 448 |
450 } // namespace media | 449 } // namespace media |
OLD | NEW |