| 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 // Audio rendering unit utilizing an AudioRendererSink to output data. | 5 // Audio rendering unit utilizing an AudioRendererSink to output data. |
| 6 // | 6 // |
| 7 // This class lives inside three threads during it's lifetime, namely: | 7 // This class lives inside three threads during it's lifetime, namely: |
| 8 // 1. Render thread | 8 // 1. Render thread |
| 9 // Where the object is created. | 9 // Where the object is created. |
| 10 // 2. Media thread (provided via constructor) | 10 // 2. Media thread (provided via constructor) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // | | Flush() | 114 // | | Flush() |
| 115 // `---------> kPlaying --------' | 115 // `---------> kPlaying --------' |
| 116 enum State { | 116 enum State { |
| 117 kUninitialized, | 117 kUninitialized, |
| 118 kInitializing, | 118 kInitializing, |
| 119 kFlushing, | 119 kFlushing, |
| 120 kFlushed, | 120 kFlushed, |
| 121 kPlaying | 121 kPlaying |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 // Callback for audio decoder to report statistics. |
| 125 void BytesDecoded(uint64_t bytes); |
| 126 |
| 124 // Callback from the audio decoder delivering decoded audio samples. | 127 // Callback from the audio decoder delivering decoded audio samples. |
| 125 void DecodedAudioReady(AudioBufferStream::Status status, | 128 void DecodedAudioReady(AudioBufferStream::Status status, |
| 126 const scoped_refptr<AudioBuffer>& buffer); | 129 const scoped_refptr<AudioBuffer>& buffer); |
| 127 | 130 |
| 128 // Handles buffers that come out of |splicer_|. | 131 // Handles buffers that come out of |splicer_|. |
| 129 // Returns true if more buffers are needed. | 132 // Returns true if more buffers are needed. |
| 130 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer); | 133 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer); |
| 131 | 134 |
| 132 // Helper functions for DecodeStatus values passed to | 135 // Helper functions for DecodeStatus values passed to |
| 133 // DecodedAudioReady(). | 136 // DecodedAudioReady(). |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 227 |
| 225 // Callback provided during Initialize(). | 228 // Callback provided during Initialize(). |
| 226 PipelineStatusCB init_cb_; | 229 PipelineStatusCB init_cb_; |
| 227 | 230 |
| 228 // Callback provided to Flush(). | 231 // Callback provided to Flush(). |
| 229 base::Closure flush_cb_; | 232 base::Closure flush_cb_; |
| 230 | 233 |
| 231 // Overridable tick clock for testing. | 234 // Overridable tick clock for testing. |
| 232 std::unique_ptr<base::TickClock> tick_clock_; | 235 std::unique_ptr<base::TickClock> tick_clock_; |
| 233 | 236 |
| 237 // Bytes decoded since the last time statistics was reported. |
| 238 uint64_t bytes_decoded_; |
| 239 |
| 234 // Memory usage of |algorithm_| recorded during the last | 240 // Memory usage of |algorithm_| recorded during the last |
| 235 // HandleSplicerBuffer_Locked() call. | 241 // HandleSplicerBuffer_Locked() call. |
| 236 int64_t last_audio_memory_usage_; | 242 int64_t last_audio_memory_usage_; |
| 237 | 243 |
| 238 // Sample rate of the last decoded audio buffer. Allows for detection of | 244 // Sample rate of the last decoded audio buffer. Allows for detection of |
| 239 // sample rate changes due to implicit AAC configuration change. | 245 // sample rate changes due to implicit AAC configuration change. |
| 240 int last_decoded_sample_rate_; | 246 int last_decoded_sample_rate_; |
| 241 | 247 |
| 242 // After Initialize() has completed, all variables below must be accessed | 248 // After Initialize() has completed, all variables below must be accessed |
| 243 // under |lock_|. ------------------------------------------------------------ | 249 // under |lock_|. ------------------------------------------------------------ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 305 |
| 300 // NOTE: Weak pointers must be invalidated before all other member variables. | 306 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 301 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 307 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 302 | 308 |
| 303 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 309 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 304 }; | 310 }; |
| 305 | 311 |
| 306 } // namespace media | 312 } // namespace media |
| 307 | 313 |
| 308 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 314 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |