| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // AudioRenderer implementation. | 68 // AudioRenderer implementation. |
| 69 virtual void Initialize(DemuxerStream* stream, | 69 virtual void Initialize(DemuxerStream* stream, |
| 70 const PipelineStatusCB& init_cb, | 70 const PipelineStatusCB& init_cb, |
| 71 const StatisticsCB& statistics_cb, | 71 const StatisticsCB& statistics_cb, |
| 72 const TimeCB& time_cb, | 72 const TimeCB& time_cb, |
| 73 const BufferingStateCB& buffering_state_cb, | 73 const BufferingStateCB& buffering_state_cb, |
| 74 const base::Closure& ended_cb, | 74 const base::Closure& ended_cb, |
| 75 const PipelineStatusCB& error_cb) OVERRIDE; | 75 const PipelineStatusCB& error_cb) OVERRIDE; |
| 76 virtual void StartRendering() OVERRIDE; | 76 virtual void StartRendering() OVERRIDE; |
| 77 virtual void StopRendering() OVERRIDE; | 77 virtual void StopRendering() OVERRIDE; |
| 78 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE; |
| 78 virtual void Flush(const base::Closure& callback) OVERRIDE; | 79 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 79 virtual void Stop(const base::Closure& callback) OVERRIDE; | 80 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 80 virtual void SetPlaybackRate(float rate) OVERRIDE; | 81 virtual void SetPlaybackRate(float rate) OVERRIDE; |
| 81 virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE; | 82 virtual void StartPlaying() OVERRIDE; |
| 82 virtual void SetVolume(float volume) OVERRIDE; | 83 virtual void SetVolume(float volume) OVERRIDE; |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 friend class AudioRendererImplTest; | 86 friend class AudioRendererImplTest; |
| 86 | 87 |
| 87 // Important detail: being in kPlaying doesn't imply that audio is being | 88 // Important detail: being in kPlaying doesn't imply that audio is being |
| 88 // rendered. Rather, it means that the renderer is ready to go. The actual | 89 // rendered. Rather, it means that the renderer is ready to go. The actual |
| 89 // rendering of audio is controlled via Start/StopRendering(). | 90 // rendering of audio is controlled via Start/StopRendering(). |
| 90 // | 91 // |
| 91 // kUninitialized | 92 // kUninitialized |
| 92 // | Initialize() | 93 // | Initialize() |
| 93 // | | 94 // | |
| 94 // V | 95 // V |
| 95 // kInitializing | 96 // kInitializing |
| 96 // | Decoders initialized | 97 // | Decoders initialized |
| 97 // | | 98 // | |
| 98 // V Decoders reset | 99 // V Decoders reset |
| 99 // kFlushed <------------------ kFlushing | 100 // kFlushed <------------------ kFlushing |
| 100 // | StartPlayingFrom() ^ | 101 // | StartPlaying() ^ |
| 101 // | | | 102 // | | |
| 102 // | | Flush() | 103 // | | Flush() |
| 103 // `---------> kPlaying --------' | 104 // `---------> kPlaying --------' |
| 104 enum State { | 105 enum State { |
| 105 kUninitialized, | 106 kUninitialized, |
| 106 kInitializing, | 107 kInitializing, |
| 107 kFlushing, | 108 kFlushing, |
| 108 kFlushed, | 109 kFlushed, |
| 109 kPlaying, | 110 kPlaying, |
| 110 kStopped, | 111 kStopped, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 249 |
| 249 // NOTE: Weak pointers must be invalidated before all other member variables. | 250 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 250 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 251 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 251 | 252 |
| 252 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 253 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 } // namespace media | 256 } // namespace media |
| 256 | 257 |
| 257 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 258 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |