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

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

Issue 1942803002: Caching AudioOutputDevice instances in mixer manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, fix for sleep() compile error on win and a bit of cleanup around timeouts. Created 4 years, 7 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 public: 57 public:
58 // |task_runner| is the thread on which AudioRendererImpl will execute. 58 // |task_runner| is the thread on which AudioRendererImpl will execute.
59 // 59 //
60 // |sink| is used as the destination for the rendered audio. 60 // |sink| is used as the destination for the rendered audio.
61 // 61 //
62 // |decoders| contains the AudioDecoders to use when initializing. 62 // |decoders| contains the AudioDecoders to use when initializing.
63 AudioRendererImpl( 63 AudioRendererImpl(
64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
65 AudioRendererSink* sink, 65 AudioRendererSink* sink,
66 ScopedVector<AudioDecoder> decoders, 66 ScopedVector<AudioDecoder> decoders,
67 const AudioHardwareConfig& hardware_config,
68 const scoped_refptr<MediaLog>& media_log); 67 const scoped_refptr<MediaLog>& media_log);
69 ~AudioRendererImpl() override; 68 ~AudioRendererImpl() override;
70 69
71 // TimeSource implementation. 70 // TimeSource implementation.
72 void StartTicking() override; 71 void StartTicking() override;
73 void StopTicking() override; 72 void StopTicking() override;
74 void SetPlaybackRate(double rate) override; 73 void SetPlaybackRate(double rate) override;
75 void SetMediaTime(base::TimeDelta time) override; 74 void SetMediaTime(base::TimeDelta time) override;
76 base::TimeDelta CurrentMediaTime() override; 75 base::TimeDelta CurrentMediaTime() override;
77 bool GetWallClockTimes( 76 bool GetWallClockTimes(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Whether or not we expect to handle config changes. 199 // Whether or not we expect to handle config changes.
201 bool expecting_config_changes_; 200 bool expecting_config_changes_;
202 201
203 // The sink (destination) for rendered audio. |sink_| must only be accessed 202 // The sink (destination) for rendered audio. |sink_| must only be accessed
204 // on |task_runner_|. |sink_| must never be called under |lock_| or else we 203 // on |task_runner_|. |sink_| must never be called under |lock_| or else we
205 // may deadlock between |task_runner_| and the audio callback thread. 204 // may deadlock between |task_runner_| and the audio callback thread.
206 scoped_refptr<media::AudioRendererSink> sink_; 205 scoped_refptr<media::AudioRendererSink> sink_;
207 206
208 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; 207 std::unique_ptr<AudioBufferStream> audio_buffer_stream_;
209 208
210 // Interface to the hardware audio params.
211 const AudioHardwareConfig& hardware_config_;
212
213 scoped_refptr<MediaLog> media_log_; 209 scoped_refptr<MediaLog> media_log_;
214 210
215 // Cached copy of hardware params from |hardware_config_|. 211 // Cached copy of hardware params from |sink_|.
216 AudioParameters audio_parameters_; 212 AudioParameters audio_parameters_;
217 213
218 // Callbacks provided during Initialize(). 214 // Callbacks provided during Initialize().
219 PipelineStatusCB init_cb_; 215 PipelineStatusCB init_cb_;
220 BufferingStateCB buffering_state_cb_; 216 BufferingStateCB buffering_state_cb_;
221 base::Closure ended_cb_; 217 base::Closure ended_cb_;
222 PipelineStatusCB error_cb_; 218 PipelineStatusCB error_cb_;
223 StatisticsCB statistics_cb_; 219 StatisticsCB statistics_cb_;
224 220
225 // Callback provided to Flush(). 221 // Callback provided to Flush().
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 288
293 // NOTE: Weak pointers must be invalidated before all other member variables. 289 // NOTE: Weak pointers must be invalidated before all other member variables.
294 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 290 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
295 291
296 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 292 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
297 }; 293 };
298 294
299 } // namespace media 295 } // namespace media
300 296
301 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ 297 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698