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

Side by Side Diff: media/audio/pulse/pulse_util.cc

Issue 2469023002: Support floating-point audio output for Linux (Closed)
Patch Set: Created 4 years, 1 month 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 #include "media/audio/pulse/pulse_util.h" 5 #include "media/audio/pulse/pulse_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 pa_stream** stream, 172 pa_stream** stream,
173 const AudioParameters& params, 173 const AudioParameters& params,
174 const std::string& device_id, 174 const std::string& device_id,
175 pa_stream_notify_cb_t stream_callback, 175 pa_stream_notify_cb_t stream_callback,
176 void* user_data) { 176 void* user_data) {
177 DCHECK(mainloop); 177 DCHECK(mainloop);
178 DCHECK(context); 178 DCHECK(context);
179 179
180 // Set sample specifications. 180 // Set sample specifications.
181 pa_sample_spec sample_specifications; 181 pa_sample_spec sample_specifications;
182 #if 1
DaleCurtis 2016/11/01 18:51:37 #if 0?
Raymond Toy 2016/11/01 20:00:50 This is for the input stream. I don't want to chan
182 sample_specifications.format = BitsToPASampleFormat( 183 sample_specifications.format = BitsToPASampleFormat(
183 params.bits_per_sample()); 184 params.bits_per_sample());
185 #else
186 sample_specifications.format = PA_SAMPLE_FLOAT32;
187 #endif
184 sample_specifications.rate = params.sample_rate(); 188 sample_specifications.rate = params.sample_rate();
185 sample_specifications.channels = params.channels(); 189 sample_specifications.channels = params.channels();
186 190
187 // Get channel mapping and open recording stream. 191 // Get channel mapping and open recording stream.
188 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap( 192 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap(
189 params.channel_layout()); 193 params.channel_layout());
190 pa_channel_map* map = (source_channel_map.channels != 0) ? 194 pa_channel_map* map = (source_channel_map.channels != 0) ?
191 &source_channel_map : NULL; 195 &source_channel_map : NULL;
192 196
193 // Create a new recording stream and 197 // Create a new recording stream and
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 pa_context_state_t context_state = pa_context_get_state(*context); 282 pa_context_state_t context_state = pa_context_get_state(*context);
279 RETURN_ON_FAILURE(PA_CONTEXT_IS_GOOD(context_state), 283 RETURN_ON_FAILURE(PA_CONTEXT_IS_GOOD(context_state),
280 "Invalid PulseAudio context state."); 284 "Invalid PulseAudio context state.");
281 if (context_state == PA_CONTEXT_READY) 285 if (context_state == PA_CONTEXT_READY)
282 break; 286 break;
283 pa_threaded_mainloop_wait(*mainloop); 287 pa_threaded_mainloop_wait(*mainloop);
284 } 288 }
285 289
286 // Set sample specifications. 290 // Set sample specifications.
287 pa_sample_spec sample_specifications; 291 pa_sample_spec sample_specifications;
292 #if 0
288 sample_specifications.format = BitsToPASampleFormat( 293 sample_specifications.format = BitsToPASampleFormat(
289 params.bits_per_sample()); 294 params.bits_per_sample());
295 #else
296 sample_specifications.format = PA_SAMPLE_FLOAT32;
297 #endif
290 sample_specifications.rate = params.sample_rate(); 298 sample_specifications.rate = params.sample_rate();
291 sample_specifications.channels = params.channels(); 299 sample_specifications.channels = params.channels();
292 300
293 // Get channel mapping. 301 // Get channel mapping.
294 pa_channel_map* map = NULL; 302 pa_channel_map* map = NULL;
295 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap( 303 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap(
296 params.channel_layout()); 304 params.channel_layout());
297 if (source_channel_map.channels != 0) { 305 if (source_channel_map.channels != 0) {
298 // The source data uses a supported channel map so we will use it rather 306 // The source data uses a supported channel map so we will use it rather
299 // than the default channel map (NULL). 307 // than the default channel map (NULL).
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 367 }
360 368
361 return true; 369 return true;
362 } 370 }
363 371
364 #undef RETURN_ON_FAILURE 372 #undef RETURN_ON_FAILURE
365 373
366 } // namespace pulse 374 } // namespace pulse
367 375
368 } // namespace media 376 } // namespace media
OLDNEW
« media/audio/pulse/pulse_output.cc ('K') | « media/audio/pulse/pulse_output.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698