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

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: Fix ClocklessAudioSink 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
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // AudioRenderer implementation. 77 // AudioRenderer implementation.
78 virtual void Initialize(DemuxerStream* stream, 78 virtual void Initialize(DemuxerStream* stream,
79 const PipelineStatusCB& init_cb, 79 const PipelineStatusCB& init_cb,
80 const StatisticsCB& statistics_cb, 80 const StatisticsCB& statistics_cb,
81 const TimeCB& time_cb, 81 const TimeCB& time_cb,
82 const BufferingStateCB& buffering_state_cb, 82 const BufferingStateCB& buffering_state_cb,
83 const base::Closure& ended_cb, 83 const base::Closure& ended_cb,
84 const PipelineStatusCB& error_cb) OVERRIDE; 84 const PipelineStatusCB& error_cb) OVERRIDE;
85 virtual TimeSource* GetTimeSource() OVERRIDE; 85 virtual TimeSource* GetTimeSource() OVERRIDE;
86 virtual void Flush(const base::Closure& callback) OVERRIDE; 86 virtual void Flush(const base::Closure& callback) OVERRIDE;
87 virtual void Stop(const base::Closure& callback) OVERRIDE;
88 virtual void StartPlaying() OVERRIDE; 87 virtual void StartPlaying() OVERRIDE;
89 virtual void SetVolume(float volume) OVERRIDE; 88 virtual void SetVolume(float volume) OVERRIDE;
90 89
91 private: 90 private:
92 friend class AudioRendererImplTest; 91 friend class AudioRendererImplTest;
93 92
94 // Important detail: being in kPlaying doesn't imply that audio is being 93 // Important detail: being in kPlaying doesn't imply that audio is being
95 // rendered. Rather, it means that the renderer is ready to go. The actual 94 // rendered. Rather, it means that the renderer is ready to go. The actual
96 // rendering of audio is controlled via Start/StopRendering(). 95 // rendering of audio is controlled via Start/StopRendering().
97 // 96 //
98 // kUninitialized 97 // kUninitialized
99 // | Initialize() 98 // | Initialize()
100 // | 99 // |
101 // V 100 // V
102 // kInitializing 101 // kInitializing
103 // | Decoders initialized 102 // | Decoders initialized
104 // | 103 // |
105 // V Decoders reset 104 // V Decoders reset
106 // kFlushed <------------------ kFlushing 105 // kFlushed <------------------ kFlushing
107 // | StartPlaying() ^ 106 // | StartPlaying() ^
108 // | | 107 // | |
109 // | | Flush() 108 // | | Flush()
110 // `---------> kPlaying --------' 109 // `---------> kPlaying --------'
111 enum State { 110 enum State {
112 kUninitialized, 111 kUninitialized,
113 kInitializing, 112 kInitializing,
114 kFlushing, 113 kFlushing,
115 kFlushed, 114 kFlushed,
116 kPlaying, 115 kPlaying
117 kStopped,
118 }; 116 };
119 117
120 // Callback from the audio decoder delivering decoded audio samples. 118 // Callback from the audio decoder delivering decoded audio samples.
121 void DecodedAudioReady(AudioBufferStream::Status status, 119 void DecodedAudioReady(AudioBufferStream::Status status,
122 const scoped_refptr<AudioBuffer>& buffer); 120 const scoped_refptr<AudioBuffer>& buffer);
123 121
124 // Handles buffers that come out of |splicer_|. 122 // Handles buffers that come out of |splicer_|.
125 // Returns true if more buffers are needed. 123 // Returns true if more buffers are needed.
126 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer); 124 bool HandleSplicerBuffer_Locked(const scoped_refptr<AudioBuffer>& buffer);
127 125
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 253
256 // NOTE: Weak pointers must be invalidated before all other member variables. 254 // NOTE: Weak pointers must be invalidated before all other member variables.
257 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 255 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
258 256
259 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 257 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
260 }; 258 };
261 259
262 } // namespace media 260 } // namespace media
263 261
264 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 262 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698