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 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 public: | 86 public: |
87 virtual ~SyncReader() {} | 87 virtual ~SyncReader() {} |
88 | 88 |
89 // Notify the synchronous reader the number of bytes in the | 89 // Notify the synchronous reader the number of bytes in the |
90 // AudioOutputController not yet played. This is used by SyncReader to | 90 // AudioOutputController not yet played. This is used by SyncReader to |
91 // prepare more data and perform synchronization. Also inform about if any | 91 // prepare more data and perform synchronization. Also inform about if any |
92 // frames has been skipped by the renderer (typically the OS). The renderer | 92 // frames has been skipped by the renderer (typically the OS). The renderer |
93 // source can handle this appropriately depending on the type of source. An | 93 // source can handle this appropriately depending on the type of source. An |
94 // ordinary file playout would ignore this. | 94 // ordinary file playout would ignore this. |
95 virtual void UpdatePendingBytes(uint32_t bytes, | 95 virtual void UpdatePendingBytes(uint32_t bytes, |
96 uint32_t frames_skipped) = 0; | 96 uint32_t frames_skipped, |
| 97 const AudioTimestamp& output_timestamp) = 0; |
97 | 98 |
98 // Attempts to completely fill |dest|, zeroing |dest| if the request can not | 99 // Attempts to completely fill |dest|, zeroing |dest| if the request can not |
99 // be fulfilled (due to timeout). | 100 // be fulfilled (due to timeout). |
100 virtual void Read(AudioBus* dest) = 0; | 101 virtual void Read(AudioBus* dest) = 0; |
101 | 102 |
102 // Close this synchronous reader. | 103 // Close this synchronous reader. |
103 virtual void Close() = 0; | 104 virtual void Close() = 0; |
104 }; | 105 }; |
105 | 106 |
106 // Factory method for creating an AudioOutputController. | 107 // Factory method for creating an AudioOutputController. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // the same state transition back to the current state as a call to | 159 // the same state transition back to the current state as a call to |
159 // OnDeviceChange (unless it is currently diverting, see | 160 // OnDeviceChange (unless it is currently diverting, see |
160 // Start/StopDiverting below, in which case the state transition | 161 // Start/StopDiverting below, in which case the state transition |
161 // will happen when StopDiverting is called). | 162 // will happen when StopDiverting is called). |
162 void SwitchOutputDevice(const std::string& output_device_id, | 163 void SwitchOutputDevice(const std::string& output_device_id, |
163 const base::Closure& callback); | 164 const base::Closure& callback); |
164 | 165 |
165 // AudioSourceCallback implementation. | 166 // AudioSourceCallback implementation. |
166 int OnMoreData(AudioBus* dest, | 167 int OnMoreData(AudioBus* dest, |
167 uint32_t total_bytes_delay, | 168 uint32_t total_bytes_delay, |
168 uint32_t frames_skipped) override; | 169 uint32_t frames_skipped, |
| 170 const AudioTimestamp& output_timestamp) override; |
169 void OnError(AudioOutputStream* stream) override; | 171 void OnError(AudioOutputStream* stream) override; |
170 | 172 |
171 // AudioDeviceListener implementation. When called AudioOutputController will | 173 // AudioDeviceListener implementation. When called AudioOutputController will |
172 // shutdown the existing |stream_|, transition to the kRecreating state, | 174 // shutdown the existing |stream_|, transition to the kRecreating state, |
173 // create a new stream, and then transition back to an equivalent state prior | 175 // create a new stream, and then transition back to an equivalent state prior |
174 // to being called. | 176 // to being called. |
175 void OnDeviceChange() override; | 177 void OnDeviceChange() override; |
176 | 178 |
177 // AudioSourceDiverter implementation. | 179 // AudioSourceDiverter implementation. |
178 const AudioParameters& GetAudioParameters() override; | 180 const AudioParameters& GetAudioParameters() override; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // be accessed while |error_lock_| is held. | 283 // be accessed while |error_lock_| is held. |
282 bool ignore_errors_during_stop_close_; | 284 bool ignore_errors_during_stop_close_; |
283 base::Lock error_lock_; | 285 base::Lock error_lock_; |
284 | 286 |
285 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 287 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
286 }; | 288 }; |
287 | 289 |
288 } // namespace media | 290 } // namespace media |
289 | 291 |
290 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 292 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
OLD | NEW |