Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: media/filters/audio_renderer_impl.h

Issue 407583002: Fold AudioRenderer::Stop() into the dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Flush(const base::Closure& callback) OVERRIDE; 78 virtual void Flush(const base::Closure& callback) OVERRIDE;
79 virtual void Stop(const base::Closure& callback) OVERRIDE;
80 virtual void SetPlaybackRate(float rate) OVERRIDE; 79 virtual void SetPlaybackRate(float rate) OVERRIDE;
81 virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE; 80 virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE;
82 virtual void SetVolume(float volume) OVERRIDE; 81 virtual void SetVolume(float volume) OVERRIDE;
83 82
84 private: 83 private:
85 friend class AudioRendererImplTest; 84 friend class AudioRendererImplTest;
86 85
87 // Important detail: being in kPlaying doesn't imply that audio is being 86 // 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 87 // rendered. Rather, it means that the renderer is ready to go. The actual
89 // rendering of audio is controlled via Start/StopRendering(). 88 // rendering of audio is controlled via Start/StopRendering().
90 // 89 //
91 // kUninitialized 90 // kUninitialized
92 // | Initialize() 91 // | Initialize()
93 // | 92 // |
94 // V 93 // V
95 // kInitializing 94 // kInitializing
96 // | Decoders initialized 95 // | Decoders initialized
97 // | 96 // |
98 // V Decoders reset 97 // V Decoders reset
99 // kFlushed <------------------ kFlushing 98 // kFlushed <------------------ kFlushing
100 // | StartPlayingFrom() ^ 99 // | StartPlayingFrom() ^
101 // | | 100 // | |
102 // | | Flush() 101 // | | Flush()
103 // `---------> kPlaying --------' 102 // `---------> kPlaying --------'
104 enum State { 103 enum State {
105 kUninitialized, 104 kUninitialized,
106 kInitializing, 105 kInitializing,
107 kFlushing, 106 kFlushing,
108 kFlushed, 107 kFlushed,
109 kPlaying, 108 kPlaying
110 kStopped,
111 }; 109 };
112 110
113 // Callback from the audio decoder delivering decoded audio samples. 111 // Callback from the audio decoder delivering decoded audio samples.
114 void DecodedAudioReady(AudioBufferStream::Status status, 112 void DecodedAudioReady(AudioBufferStream::Status status,
115 const scoped_refptr<AudioBuffer>& buffer); 113 const scoped_refptr<AudioBuffer>& buffer);
116 114
117 // Handles buffers that come out of |splicer_|. 115 // Handles buffers that come out of |splicer_|.
118 // Returns true if more buffers are needed. 116 // Returns true if more buffers are needed.
119 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer); 117 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer);
120 118
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 246
249 // NOTE: Weak pointers must be invalidated before all other member variables. 247 // NOTE: Weak pointers must be invalidated before all other member variables.
250 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 248 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
251 249
252 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 250 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
253 }; 251 };
254 252
255 } // namespace media 253 } // namespace media
256 254
257 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 255 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698