OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 kStateNormalPlayback, | 113 kStateNormalPlayback, |
114 kStateError, | 114 kStateError, |
115 }; | 115 }; |
116 | 116 |
117 static StreamMixerAlsa* Get(); | 117 static StreamMixerAlsa* Get(); |
118 static void MakeSingleThreadedForTest(); | 118 static void MakeSingleThreadedForTest(); |
119 | 119 |
120 int output_samples_per_second() const { return output_samples_per_second_; } | 120 int output_samples_per_second() const { return output_samples_per_second_; } |
121 bool empty() const { return inputs_.empty(); } | 121 bool empty() const { return inputs_.empty(); } |
122 State state() const { return state_; } | 122 State state() const { return state_; } |
123 int num_output_channels() const { return num_output_channels_; } | |
124 | 123 |
125 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const { | 124 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const { |
126 return mixer_task_runner_; | 125 return mixer_task_runner_; |
127 } | 126 } |
128 | 127 |
129 // Adds an input to the mixer. The input will live at least until | 128 // Adds an input to the mixer. The input will live at least until |
130 // RemoveInput(input) is called. Can be called on any thread. | 129 // RemoveInput(input) is called. Can be called on any thread. |
131 void AddInput(std::unique_ptr<InputQueue> input); | 130 void AddInput(std::unique_ptr<InputQueue> input); |
132 // Instructs the mixer to remove an input. The input should not be referenced | 131 // Instructs the mixer to remove an input. The input should not be referenced |
133 // after this is called. Can be called on any thread. | 132 // after this is called. Can be called on any thread. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 int requested_output_samples_per_second_; | 198 int requested_output_samples_per_second_; |
200 int output_samples_per_second_; | 199 int output_samples_per_second_; |
201 snd_pcm_t* pcm_; | 200 snd_pcm_t* pcm_; |
202 snd_pcm_hw_params_t* pcm_hw_params_; | 201 snd_pcm_hw_params_t* pcm_hw_params_; |
203 snd_pcm_status_t* pcm_status_; | 202 snd_pcm_status_t* pcm_status_; |
204 snd_pcm_format_t pcm_format_; | 203 snd_pcm_format_t pcm_format_; |
205 | 204 |
206 // User-configurable ALSA parameters. This caches the results, so the code | 205 // User-configurable ALSA parameters. This caches the results, so the code |
207 // only has to interact with the command line parameters once. | 206 // only has to interact with the command line parameters once. |
208 std::string alsa_device_name_; | 207 std::string alsa_device_name_; |
209 int num_output_channels_; | |
210 snd_pcm_uframes_t alsa_buffer_size_; | 208 snd_pcm_uframes_t alsa_buffer_size_; |
211 bool alsa_period_explicitly_set; | 209 bool alsa_period_explicitly_set; |
212 snd_pcm_uframes_t alsa_period_size_; | 210 snd_pcm_uframes_t alsa_period_size_; |
213 snd_pcm_uframes_t alsa_start_threshold_; | 211 snd_pcm_uframes_t alsa_start_threshold_; |
214 snd_pcm_uframes_t alsa_avail_min_; | 212 snd_pcm_uframes_t alsa_avail_min_; |
215 | 213 |
216 State state_; | 214 State state_; |
217 | 215 |
218 std::vector<std::unique_ptr<InputQueue>> inputs_; | 216 std::vector<std::unique_ptr<InputQueue>> inputs_; |
219 std::vector<std::unique_ptr<InputQueue>> ignored_inputs_; | 217 std::vector<std::unique_ptr<InputQueue>> ignored_inputs_; |
(...skipping 14 matching lines...) Expand all Loading... |
234 | 232 |
235 std::vector<CastMediaShlib::LoopbackAudioObserver*> loopback_observers_; | 233 std::vector<CastMediaShlib::LoopbackAudioObserver*> loopback_observers_; |
236 | 234 |
237 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsa); | 235 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsa); |
238 }; | 236 }; |
239 | 237 |
240 } // namespace media | 238 } // namespace media |
241 } // namespace chromecast | 239 } // namespace chromecast |
242 | 240 |
243 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 241 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
OLD | NEW |