| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // A synchronous reader interface used by AudioOutputController for | 83 // A synchronous reader interface used by AudioOutputController for |
| 84 // synchronous reading. | 84 // synchronous reading. |
| 85 // TODO(crogers): find a better name for this class and the Read() method | 85 // TODO(crogers): find a better name for this class and the Read() method |
| 86 // now that it can handle synchronized I/O. | 86 // now that it can handle synchronized I/O. |
| 87 class SyncReader { | 87 class SyncReader { |
| 88 public: | 88 public: |
| 89 virtual ~SyncReader() {} | 89 virtual ~SyncReader() {} |
| 90 | 90 |
| 91 // Notify the synchronous reader the number of bytes in the | 91 // This is used by SyncReader to prepare more data and perform |
| 92 // AudioOutputController not yet played. This is used by SyncReader to | 92 // synchronization. Also inform about output delay at a certain moment and |
| 93 // prepare more data and perform synchronization. Also inform about if any | 93 // if any frames have been skipped by the renderer (typically the OS). The |
| 94 // frames has been skipped by the renderer (typically the OS). The renderer | 94 // renderer source can handle this appropriately depending on the type of |
| 95 // source can handle this appropriately depending on the type of source. An | 95 // source. An ordinary file playout would ignore this. |
| 96 // ordinary file playout would ignore this. | 96 virtual void RequestMoreData(base::TimeDelta delay, |
| 97 virtual void UpdatePendingBytes(uint32_t bytes, | 97 base::TimeTicks delay_timestamp, |
| 98 uint32_t frames_skipped) = 0; | 98 int prior_frames_skipped) = 0; |
| 99 | 99 |
| 100 // Attempts to completely fill |dest|, zeroing |dest| if the request can not | 100 // Attempts to completely fill |dest|, zeroing |dest| if the request can not |
| 101 // be fulfilled (due to timeout). | 101 // be fulfilled (due to timeout). |
| 102 virtual void Read(AudioBus* dest) = 0; | 102 virtual void Read(AudioBus* dest) = 0; |
| 103 | 103 |
| 104 // Close this synchronous reader. | 104 // Close this synchronous reader. |
| 105 virtual void Close() = 0; | 105 virtual void Close() = 0; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 // Factory method for creating an AudioOutputController. | 108 // Factory method for creating an AudioOutputController. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // be accessed while |error_lock_| is held. | 284 // be accessed while |error_lock_| is held. |
| 285 bool ignore_errors_during_stop_close_; | 285 bool ignore_errors_during_stop_close_; |
| 286 base::Lock error_lock_; | 286 base::Lock error_lock_; |
| 287 | 287 |
| 288 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 288 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 } // namespace media | 291 } // namespace media |
| 292 | 292 |
| 293 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 293 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| OLD | NEW |