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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return false; | 131 return false; |
132 | 132 |
133 if (!task_runner()->PostTask(FROM_HERE, | 133 if (!task_runner()->PostTask(FROM_HERE, |
134 base::Bind(&AudioOutputDevice::SetVolumeOnIOThread, this, volume))) { | 134 base::Bind(&AudioOutputDevice::SetVolumeOnIOThread, this, volume))) { |
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 OutputDeviceInfo AudioOutputDevice::GetOutputDeviceInfo() { |
142 return this; | |
143 } | |
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() { | |
153 CHECK(!task_runner()->BelongsToCurrentThread()); | 142 CHECK(!task_runner()->BelongsToCurrentThread()); |
154 did_receive_auth_.Wait(); | 143 did_receive_auth_.Wait(); |
155 return output_params_; | 144 return OutputDeviceInfo(device_id_, device_status_, output_params_); |
156 } | |
157 | |
158 OutputDeviceStatus AudioOutputDevice::GetDeviceStatus() { | |
159 CHECK(!task_runner()->BelongsToCurrentThread()); | |
160 did_receive_auth_.Wait(); | |
161 return device_status_; | |
162 } | 145 } |
163 | 146 |
164 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { | 147 void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() { |
165 DCHECK(task_runner()->BelongsToCurrentThread()); | 148 DCHECK(task_runner()->BelongsToCurrentThread()); |
166 DCHECK_EQ(state_, IDLE); | 149 DCHECK_EQ(state_, IDLE); |
167 state_ = AUTHORIZING; | 150 state_ = AUTHORIZING; |
168 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, | 151 ipc_->RequestDeviceAuthorization(this, session_id_, device_id_, |
169 security_origin_); | 152 security_origin_); |
170 } | 153 } |
171 | 154 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 424 |
442 // Update the audio-delay measurement, inform about the number of skipped | 425 // Update the audio-delay measurement, inform about the number of skipped |
443 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 426 // 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 | 427 // the shared memory the Render() call is writing directly into the shared |
445 // memory. | 428 // memory. |
446 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 429 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
447 frames_skipped); | 430 frames_skipped); |
448 } | 431 } |
449 | 432 |
450 } // namespace media | 433 } // namespace media |
OLD | NEW |