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

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

Issue 14217008: Remove reference counting from media::DemuxerStream and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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/filters/audio_decoder_selector_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // 52 //
53 // |set_decryptor_ready_cb| is fired when the audio decryptor is available 53 // |set_decryptor_ready_cb| is fired when the audio decryptor is available
54 // (only applicable if the stream is encrypted and we have a decryptor). 54 // (only applicable if the stream is encrypted and we have a decryptor).
55 AudioRendererImpl(const scoped_refptr<base::MessageLoopProxy>& message_loop, 55 AudioRendererImpl(const scoped_refptr<base::MessageLoopProxy>& message_loop,
56 AudioRendererSink* sink, 56 AudioRendererSink* sink,
57 ScopedVector<AudioDecoder> decoders, 57 ScopedVector<AudioDecoder> decoders,
58 const SetDecryptorReadyCB& set_decryptor_ready_cb); 58 const SetDecryptorReadyCB& set_decryptor_ready_cb);
59 virtual ~AudioRendererImpl(); 59 virtual ~AudioRendererImpl();
60 60
61 // AudioRenderer implementation. 61 // AudioRenderer implementation.
62 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 62 virtual void Initialize(DemuxerStream* stream,
63 const PipelineStatusCB& init_cb, 63 const PipelineStatusCB& init_cb,
64 const StatisticsCB& statistics_cb, 64 const StatisticsCB& statistics_cb,
65 const base::Closure& underflow_cb, 65 const base::Closure& underflow_cb,
66 const TimeCB& time_cb, 66 const TimeCB& time_cb,
67 const base::Closure& ended_cb, 67 const base::Closure& ended_cb,
68 const base::Closure& disabled_cb, 68 const base::Closure& disabled_cb,
69 const PipelineStatusCB& error_cb) OVERRIDE; 69 const PipelineStatusCB& error_cb) OVERRIDE;
70 virtual void Play(const base::Closure& callback) OVERRIDE; 70 virtual void Play(const base::Closure& callback) OVERRIDE;
71 virtual void Pause(const base::Closure& callback) OVERRIDE; 71 virtual void Pause(const base::Closure& callback) OVERRIDE;
72 virtual void Flush(const base::Closure& callback) OVERRIDE; 72 virtual void Flush(const base::Closure& callback) OVERRIDE;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // in the kPrerolling state. 153 // in the kPrerolling state.
154 bool IsBeforePrerollTime(const scoped_refptr<DataBuffer>& buffer); 154 bool IsBeforePrerollTime(const scoped_refptr<DataBuffer>& buffer);
155 155
156 // Called when |decoder_selector_| has selected |decoder| or is null if no 156 // Called when |decoder_selector_| has selected |decoder| or is null if no
157 // decoder could be selected. 157 // decoder could be selected.
158 // 158 //
159 // |decrypting_demuxer_stream| is non-null if a DecryptingDemuxerStream was 159 // |decrypting_demuxer_stream| is non-null if a DecryptingDemuxerStream was
160 // created to help decrypt the encrypted stream. 160 // created to help decrypt the encrypted stream.
161 void OnDecoderSelected( 161 void OnDecoderSelected(
162 scoped_ptr<AudioDecoder> decoder, 162 scoped_ptr<AudioDecoder> decoder,
163 const scoped_refptr<DecryptingDemuxerStream>& decrypting_demuxer_stream); 163 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream);
164 164
165 void ResetDecoder(const base::Closure& callback); 165 void ResetDecoder(const base::Closure& callback);
166 166
167 scoped_refptr<base::MessageLoopProxy> message_loop_; 167 scoped_refptr<base::MessageLoopProxy> message_loop_;
168 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 168 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
169 base::WeakPtr<AudioRendererImpl> weak_this_; 169 base::WeakPtr<AudioRendererImpl> weak_this_;
170 170
171 scoped_ptr<AudioSplicer> splicer_; 171 scoped_ptr<AudioSplicer> splicer_;
172 172
173 // The sink (destination) for rendered audio. |sink_| must only be accessed 173 // The sink (destination) for rendered audio. |sink_| must only be accessed
174 // on |message_loop_|. |sink_| must never be called under |lock_| or else we 174 // on |message_loop_|. |sink_| must never be called under |lock_| or else we
175 // may deadlock between |message_loop_| and the audio callback thread. 175 // may deadlock between |message_loop_| and the audio callback thread.
176 scoped_refptr<media::AudioRendererSink> sink_; 176 scoped_refptr<media::AudioRendererSink> sink_;
177 177
178 scoped_ptr<AudioDecoderSelector> decoder_selector_; 178 scoped_ptr<AudioDecoderSelector> decoder_selector_;
179 179
180 // These two will be set by AudioDecoderSelector::SelectAudioDecoder(). 180 // These two will be set by AudioDecoderSelector::SelectAudioDecoder().
181 scoped_ptr<AudioDecoder> decoder_; 181 scoped_ptr<AudioDecoder> decoder_;
182 scoped_refptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; 182 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_;
183 183
184 // AudioParameters constructed during Initialize() based on |decoder_|. 184 // AudioParameters constructed during Initialize() based on |decoder_|.
185 AudioParameters audio_parameters_; 185 AudioParameters audio_parameters_;
186 186
187 // Callbacks provided during Initialize(). 187 // Callbacks provided during Initialize().
188 PipelineStatusCB init_cb_; 188 PipelineStatusCB init_cb_;
189 StatisticsCB statistics_cb_; 189 StatisticsCB statistics_cb_;
190 base::Closure underflow_cb_; 190 base::Closure underflow_cb_;
191 TimeCB time_cb_; 191 TimeCB time_cb_;
192 base::Closure ended_cb_; 192 base::Closure ended_cb_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // Variables used only on the audio thread. --------------------------------- 263 // Variables used only on the audio thread. ---------------------------------
264 int actual_frames_per_buffer_; 264 int actual_frames_per_buffer_;
265 scoped_ptr<uint8[]> audio_buffer_; 265 scoped_ptr<uint8[]> audio_buffer_;
266 266
267 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 267 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
268 }; 268 };
269 269
270 } // namespace media 270 } // namespace media
271 271
272 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 272 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_selector_unittest.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698