| 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 // This object is created on the render thread. | 9 // This object is created on the render thread. |
| 10 // 2. Pipeline thread | 10 // 2. Pipeline thread |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace media { | 32 namespace media { |
| 33 | 33 |
| 34 class MEDIA_EXPORT AudioRendererImpl | 34 class MEDIA_EXPORT AudioRendererImpl |
| 35 : public AudioRenderer, | 35 : public AudioRenderer, |
| 36 NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback) { | 36 NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback) { |
| 37 public: | 37 public: |
| 38 // Methods called on Render thread ------------------------------------------ | 38 // Methods called on Render thread ------------------------------------------ |
| 39 // An AudioRendererSink is used as the destination for the rendered audio. | 39 // An AudioRendererSink is used as the destination for the rendered audio. |
| 40 explicit AudioRendererImpl(media::AudioRendererSink* sink); | 40 explicit AudioRendererImpl(media::AudioRendererSink* sink); |
| 41 virtual ~AudioRendererImpl(); | |
| 42 | 41 |
| 43 // Methods called on pipeline thread ---------------------------------------- | 42 // Methods called on pipeline thread ---------------------------------------- |
| 44 // Filter implementation. | 43 // Filter implementation. |
| 45 virtual void Play(const base::Closure& callback) OVERRIDE; | 44 virtual void Play(const base::Closure& callback) OVERRIDE; |
| 46 virtual void Pause(const base::Closure& callback) OVERRIDE; | 45 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 47 virtual void Flush(const base::Closure& callback) OVERRIDE; | 46 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 48 virtual void Stop(const base::Closure& callback) OVERRIDE; | 47 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 49 virtual void SetPlaybackRate(float rate) OVERRIDE; | 48 virtual void SetPlaybackRate(float rate) OVERRIDE; |
| 50 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 49 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 51 | 50 |
| 52 // AudioRenderer implementation. | 51 // AudioRenderer implementation. |
| 53 virtual void Initialize(const scoped_refptr<AudioDecoder>& decoder, | 52 virtual void Initialize(const scoped_refptr<AudioDecoder>& decoder, |
| 54 const PipelineStatusCB& init_cb, | 53 const PipelineStatusCB& init_cb, |
| 55 const base::Closure& underflow_cb, | 54 const base::Closure& underflow_cb, |
| 56 const TimeCB& time_cb) OVERRIDE; | 55 const TimeCB& time_cb) OVERRIDE; |
| 57 virtual bool HasEnded() OVERRIDE; | 56 virtual bool HasEnded() OVERRIDE; |
| 58 virtual void ResumeAfterUnderflow(bool buffer_more_audio) OVERRIDE; | 57 virtual void ResumeAfterUnderflow(bool buffer_more_audio) OVERRIDE; |
| 59 virtual void SetVolume(float volume) OVERRIDE; | 58 virtual void SetVolume(float volume) OVERRIDE; |
| 60 | 59 |
| 60 protected: |
| 61 virtual ~AudioRendererImpl(); |
| 62 |
| 61 private: | 63 private: |
| 62 friend class AudioRendererImplTest; | 64 friend class AudioRendererImplTest; |
| 63 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); | 65 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); |
| 64 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); | 66 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); |
| 65 | 67 |
| 66 // Callback from the audio decoder delivering decoded audio samples. | 68 // Callback from the audio decoder delivering decoded audio samples. |
| 67 void DecodedAudioReady(scoped_refptr<Buffer> buffer); | 69 void DecodedAudioReady(scoped_refptr<Buffer> buffer); |
| 68 | 70 |
| 69 // Fills the given buffer with audio data by delegating to its |algorithm_|. | 71 // Fills the given buffer with audio data by delegating to its |algorithm_|. |
| 70 // FillBuffer() also takes care of updating the clock. Returns the number of | 72 // FillBuffer() also takes care of updating the clock. Returns the number of |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 AudioParameters audio_parameters_; | 205 AudioParameters audio_parameters_; |
| 204 | 206 |
| 205 AudioDecoder::ReadCB read_cb_; | 207 AudioDecoder::ReadCB read_cb_; |
| 206 | 208 |
| 207 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 209 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 208 }; | 210 }; |
| 209 | 211 |
| 210 } // namespace media | 212 } // namespace media |
| 211 | 213 |
| 212 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 214 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |