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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
10 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 case LEFT_OF_CENTER: | 34 case LEFT_OF_CENTER: |
35 return PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER; | 35 return PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER; |
36 case RIGHT_OF_CENTER: | 36 case RIGHT_OF_CENTER: |
37 return PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER; | 37 return PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER; |
38 case BACK_CENTER: | 38 case BACK_CENTER: |
39 return PA_CHANNEL_POSITION_REAR_CENTER; | 39 return PA_CHANNEL_POSITION_REAR_CENTER; |
40 case SIDE_LEFT: | 40 case SIDE_LEFT: |
41 return PA_CHANNEL_POSITION_SIDE_LEFT; | 41 return PA_CHANNEL_POSITION_SIDE_LEFT; |
42 case SIDE_RIGHT: | 42 case SIDE_RIGHT: |
43 return PA_CHANNEL_POSITION_SIDE_RIGHT; | 43 return PA_CHANNEL_POSITION_SIDE_RIGHT; |
44 case CHANNELS_MAX: | |
45 return PA_CHANNEL_POSITION_INVALID; | |
46 default: | 44 default: |
47 NOTREACHED() << "Invalid channel: " << channel; | 45 NOTREACHED() << "Invalid channel: " << channel; |
48 return PA_CHANNEL_POSITION_INVALID; | 46 return PA_CHANNEL_POSITION_INVALID; |
49 } | 47 } |
50 } | 48 } |
51 | 49 |
52 } // namespace | 50 } // namespace |
53 | 51 |
54 // static, pa_stream_success_cb_t | 52 // static, pa_stream_success_cb_t |
55 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop) { | 53 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop) { |
(...skipping 23 matching lines...) Expand all Loading... |
79 NOTREACHED() << "Invalid bits per sample: " << bits_per_sample; | 77 NOTREACHED() << "Invalid bits per sample: " << bits_per_sample; |
80 return PA_SAMPLE_INVALID; | 78 return PA_SAMPLE_INVALID; |
81 } | 79 } |
82 } | 80 } |
83 | 81 |
84 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout) { | 82 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout) { |
85 pa_channel_map channel_map; | 83 pa_channel_map channel_map; |
86 pa_channel_map_init(&channel_map); | 84 pa_channel_map_init(&channel_map); |
87 | 85 |
88 channel_map.channels = ChannelLayoutToChannelCount(channel_layout); | 86 channel_map.channels = ChannelLayoutToChannelCount(channel_layout); |
89 for (Channels ch = LEFT; ch < CHANNELS_MAX; | 87 for (Channels ch = LEFT; ch <= CHANNELS_MAX; |
90 ch = static_cast<Channels>(ch + 1)) { | 88 ch = static_cast<Channels>(ch + 1)) { |
91 int channel_index = ChannelOrder(channel_layout, ch); | 89 int channel_index = ChannelOrder(channel_layout, ch); |
92 if (channel_index < 0) | 90 if (channel_index < 0) |
93 continue; | 91 continue; |
94 | 92 |
95 channel_map.map[channel_index] = ChromiumToPAChannelPosition(ch); | 93 channel_map.map[channel_index] = ChromiumToPAChannelPosition(ch); |
96 } | 94 } |
97 | 95 |
98 return channel_map; | 96 return channel_map; |
99 } | 97 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 304 } |
307 | 305 |
308 return true; | 306 return true; |
309 } | 307 } |
310 | 308 |
311 #undef RETURN_ON_FAILURE | 309 #undef RETURN_ON_FAILURE |
312 | 310 |
313 } // namespace pulse | 311 } // namespace pulse |
314 | 312 |
315 } // namespace media | 313 } // namespace media |
OLD | NEW |