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 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 public: | 23 public: |
24 AudioRendererMixer(const AudioParameters& input_params, | 24 AudioRendererMixer(const AudioParameters& input_params, |
25 const AudioParameters& output_params, | 25 const AudioParameters& output_params, |
26 const scoped_refptr<AudioRendererSink>& sink); | 26 const scoped_refptr<AudioRendererSink>& sink); |
27 virtual ~AudioRendererMixer(); | 27 virtual ~AudioRendererMixer(); |
28 | 28 |
29 // Add or remove a mixer input from mixing; called by AudioRendererMixerInput. | 29 // Add or remove a mixer input from mixing; called by AudioRendererMixerInput. |
30 void AddMixerInput(const scoped_refptr<AudioRendererMixerInput>& input); | 30 void AddMixerInput(const scoped_refptr<AudioRendererMixerInput>& input); |
31 void RemoveMixerInput(const scoped_refptr<AudioRendererMixerInput>& input); | 31 void RemoveMixerInput(const scoped_refptr<AudioRendererMixerInput>& input); |
32 | 32 |
| 33 const AudioParameters& input_params() { return input_params_; } |
| 34 const AudioParameters& output_params() { return output_params_; } |
| 35 |
33 void set_pause_delay_for_testing(base::TimeDelta delay) { | 36 void set_pause_delay_for_testing(base::TimeDelta delay) { |
34 pause_delay_ = delay; | 37 pause_delay_ = delay; |
35 } | 38 } |
36 | 39 |
37 private: | 40 private: |
38 // AudioRendererSink::RenderCallback implementation. | 41 // AudioRendererSink::RenderCallback implementation. |
39 virtual int Render(AudioBus* audio_bus, | 42 virtual int Render(AudioBus* audio_bus, |
40 int audio_delay_milliseconds) OVERRIDE; | 43 int audio_delay_milliseconds) OVERRIDE; |
41 virtual void OnRenderError() OVERRIDE; | 44 virtual void OnRenderError() OVERRIDE; |
| 45 virtual void OnDeviceChange() OVERRIDE; |
42 | 46 |
43 // Output sink for this mixer. | 47 // Output sink for this mixer. |
44 scoped_refptr<AudioRendererSink> audio_sink_; | 48 scoped_refptr<AudioRendererSink> audio_sink_; |
45 | 49 |
46 // Set of mixer inputs to be mixed by this mixer. Access is thread-safe | 50 // Set of mixer inputs to be mixed by this mixer. Access is thread-safe |
47 // through |mixer_inputs_lock_|. | 51 // through |mixer_inputs_lock_|. |
48 typedef std::list<scoped_refptr<AudioRendererMixerInput> > | 52 typedef std::list<scoped_refptr<AudioRendererMixerInput> > |
49 AudioRendererMixerInputSet; | 53 AudioRendererMixerInputSet; |
50 AudioRendererMixerInputSet mixer_inputs_; | 54 AudioRendererMixerInputSet mixer_inputs_; |
51 base::Lock mixer_inputs_lock_; | 55 base::Lock mixer_inputs_lock_; |
52 | 56 |
53 // Handles mixing and resampling between input and output parameters. | 57 // Handles mixing and resampling between input and output parameters. |
54 AudioConverter audio_converter_; | 58 AudioConverter audio_converter_; |
55 | 59 |
56 // Handles physical stream pause when no inputs are playing. For latency | 60 // Handles physical stream pause when no inputs are playing. For latency |
57 // reasons we don't want to immediately pause the physical stream. | 61 // reasons we don't want to immediately pause the physical stream. |
58 base::TimeDelta pause_delay_; | 62 base::TimeDelta pause_delay_; |
59 base::Time last_play_time_; | 63 base::Time last_play_time_; |
60 bool playing_; | 64 bool playing_; |
61 | 65 |
| 66 AudioParameters input_params_; |
| 67 AudioParameters output_params_; |
| 68 |
62 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); | 69 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); |
63 }; | 70 }; |
64 | 71 |
65 } // namespace media | 72 } // namespace media |
66 | 73 |
67 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 74 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
OLD | NEW |