OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void DoClose(const base::Closure& closed_task); | 186 void DoClose(const base::Closure& closed_task); |
187 void DoSetVolume(double volume); | 187 void DoSetVolume(double volume); |
188 void DoReportError(int code); | 188 void DoReportError(int code); |
189 | 189 |
190 // Helper method to submit a OnMoreData() call to the event handler. | 190 // Helper method to submit a OnMoreData() call to the event handler. |
191 void SubmitOnMoreData_Locked(); | 191 void SubmitOnMoreData_Locked(); |
192 | 192 |
193 // Helper method that starts physical stream. | 193 // Helper method that starts physical stream. |
194 void StartStream(); | 194 void StartStream(); |
195 | 195 |
| 196 // Helper method that stops, closes, and NULLs |*stream_|. |
| 197 void StopCloseAndClearStream(); |
| 198 |
196 // |handler_| may be called only if |state_| is not kClosed. | 199 // |handler_| may be called only if |state_| is not kClosed. |
197 EventHandler* handler_; | 200 EventHandler* handler_; |
198 AudioOutputStream* stream_; | 201 AudioOutputStream* stream_; |
199 | 202 |
200 // The current volume of the audio stream. | 203 // The current volume of the audio stream. |
201 double volume_; | 204 double volume_; |
202 | 205 |
203 // |state_| is written on the audio controller thread and is read on the | 206 // |state_| is written on the audio controller thread and is read on the |
204 // hardware audio thread. These operations need to be locked. But lock | 207 // hardware audio thread. These operations need to be locked. But lock |
205 // is not required for reading on the audio controller thread. | 208 // is not required for reading on the audio controller thread. |
(...skipping 17 matching lines...) Expand all Loading... |
223 // When starting stream we wait for data to become available. | 226 // When starting stream we wait for data to become available. |
224 // Number of times left. | 227 // Number of times left. |
225 int number_polling_attempts_left_; | 228 int number_polling_attempts_left_; |
226 | 229 |
227 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 230 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
228 }; | 231 }; |
229 | 232 |
230 } // namespace media | 233 } // namespace media |
231 | 234 |
232 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 235 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
OLD | NEW |