| 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 #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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 pa_context_state_t context_state = pa_context_get_state(*context); | 278 pa_context_state_t context_state = pa_context_get_state(*context); |
| 279 RETURN_ON_FAILURE(PA_CONTEXT_IS_GOOD(context_state), | 279 RETURN_ON_FAILURE(PA_CONTEXT_IS_GOOD(context_state), |
| 280 "Invalid PulseAudio context state."); | 280 "Invalid PulseAudio context state."); |
| 281 if (context_state == PA_CONTEXT_READY) | 281 if (context_state == PA_CONTEXT_READY) |
| 282 break; | 282 break; |
| 283 pa_threaded_mainloop_wait(*mainloop); | 283 pa_threaded_mainloop_wait(*mainloop); |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Set sample specifications. | 286 // Set sample specifications. |
| 287 pa_sample_spec sample_specifications; | 287 pa_sample_spec sample_specifications; |
| 288 sample_specifications.format = BitsToPASampleFormat( | 288 sample_specifications.format = PA_SAMPLE_FLOAT32; |
| 289 params.bits_per_sample()); | |
| 290 sample_specifications.rate = params.sample_rate(); | 289 sample_specifications.rate = params.sample_rate(); |
| 291 sample_specifications.channels = params.channels(); | 290 sample_specifications.channels = params.channels(); |
| 292 | 291 |
| 293 // Get channel mapping. | 292 // Get channel mapping. |
| 294 pa_channel_map* map = NULL; | 293 pa_channel_map* map = NULL; |
| 295 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap( | 294 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap( |
| 296 params.channel_layout()); | 295 params.channel_layout()); |
| 297 if (source_channel_map.channels != 0) { | 296 if (source_channel_map.channels != 0) { |
| 298 // The source data uses a supported channel map so we will use it rather | 297 // The source data uses a supported channel map so we will use it rather |
| 299 // than the default channel map (NULL). | 298 // than the default channel map (NULL). |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 358 } |
| 360 | 359 |
| 361 return true; | 360 return true; |
| 362 } | 361 } |
| 363 | 362 |
| 364 #undef RETURN_ON_FAILURE | 363 #undef RETURN_ON_FAILURE |
| 365 | 364 |
| 366 } // namespace pulse | 365 } // namespace pulse |
| 367 | 366 |
| 368 } // namespace media | 367 } // namespace media |
| OLD | NEW |