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: | 44 case CHANNELS_HISTOGRAM_MAX: |
45 return PA_CHANNEL_POSITION_INVALID; | 45 return PA_CHANNEL_POSITION_INVALID; |
46 default: | 46 default: |
47 NOTREACHED() << "Invalid channel: " << channel; | 47 NOTREACHED() << "Invalid channel: " << channel; |
48 return PA_CHANNEL_POSITION_INVALID; | 48 return PA_CHANNEL_POSITION_INVALID; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
53 | 53 |
54 // static, pa_stream_success_cb_t | 54 // static, pa_stream_success_cb_t |
(...skipping 24 matching lines...) Expand all Loading... |
79 NOTREACHED() << "Invalid bits per sample: " << bits_per_sample; | 79 NOTREACHED() << "Invalid bits per sample: " << bits_per_sample; |
80 return PA_SAMPLE_INVALID; | 80 return PA_SAMPLE_INVALID; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout) { | 84 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout) { |
85 pa_channel_map channel_map; | 85 pa_channel_map channel_map; |
86 pa_channel_map_init(&channel_map); | 86 pa_channel_map_init(&channel_map); |
87 | 87 |
88 channel_map.channels = ChannelLayoutToChannelCount(channel_layout); | 88 channel_map.channels = ChannelLayoutToChannelCount(channel_layout); |
89 for (Channels ch = LEFT; ch < CHANNELS_MAX; | 89 for (Channels ch = LEFT; ch < CHANNELS_HISTOGRAM_MAX; |
90 ch = static_cast<Channels>(ch + 1)) { | 90 ch = static_cast<Channels>(ch + 1)) { |
91 int channel_index = ChannelOrder(channel_layout, ch); | 91 int channel_index = ChannelOrder(channel_layout, ch); |
92 if (channel_index < 0) | 92 if (channel_index < 0) |
93 continue; | 93 continue; |
94 | 94 |
95 channel_map.map[channel_index] = ChromiumToPAChannelPosition(ch); | 95 channel_map.map[channel_index] = ChromiumToPAChannelPosition(ch); |
96 } | 96 } |
97 | 97 |
98 return channel_map; | 98 return channel_map; |
99 } | 99 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 return true; | 308 return true; |
309 } | 309 } |
310 | 310 |
311 #undef RETURN_ON_FAILURE | 311 #undef RETURN_ON_FAILURE |
312 | 312 |
313 } // namespace pulse | 313 } // namespace pulse |
314 | 314 |
315 } // namespace media | 315 } // namespace media |
OLD | NEW |