OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // We only support mono-to-stereo. | 43 // We only support mono-to-stereo. |
44 assert(mixed_frame->num_channels_ == 2 && | 44 assert(mixed_frame->num_channels_ == 2 && |
45 frame->num_channels_ == 1); | 45 frame->num_channels_ == 1); |
46 AudioFrameOperations::MonoToStereo(frame); | 46 AudioFrameOperations::MonoToStereo(frame); |
47 } | 47 } |
48 | 48 |
49 *mixed_frame += *frame; | 49 *mixed_frame += *frame; |
50 } | 50 } |
51 | 51 |
52 // Return the max number of channels from a |list| composed of AudioFrames. | 52 // Return the max number of channels from a |list| composed of AudioFrames. |
53 int MaxNumChannels(const AudioFrameList* list) { | 53 size_t MaxNumChannels(const AudioFrameList* list) { |
54 int max_num_channels = 1; | 54 size_t max_num_channels = 1; |
55 for (AudioFrameList::const_iterator iter = list->begin(); | 55 for (AudioFrameList::const_iterator iter = list->begin(); |
56 iter != list->end(); | 56 iter != list->end(); |
57 ++iter) { | 57 ++iter) { |
58 max_num_channels = std::max(max_num_channels, (*iter)->num_channels_); | 58 max_num_channels = std::max(max_num_channels, (*iter)->num_channels_); |
59 } | 59 } |
60 return max_num_channels; | 60 return max_num_channels; |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 int retval = 0; | 273 int retval = 0; |
274 { | 274 { |
275 CriticalSectionScoped cs(_crit.get()); | 275 CriticalSectionScoped cs(_crit.get()); |
276 | 276 |
277 // TODO(henrike): it might be better to decide the number of channels | 277 // TODO(henrike): it might be better to decide the number of channels |
278 // with an API instead of dynamically. | 278 // with an API instead of dynamically. |
279 | 279 |
280 // Find the max channels over all mixing lists. | 280 // Find the max channels over all mixing lists. |
281 const int num_mixed_channels = std::max(MaxNumChannels(&mixList), | 281 const size_t num_mixed_channels = std::max(MaxNumChannels(&mixList), |
282 std::max(MaxNumChannels(&additionalFramesList), | 282 std::max(MaxNumChannels(&additionalFramesList), |
283 MaxNumChannels(&rampOutList))); | 283 MaxNumChannels(&rampOutList))); |
284 | 284 |
285 mixedAudio->UpdateFrame(-1, _timeStamp, NULL, 0, _outputFrequency, | 285 mixedAudio->UpdateFrame(-1, _timeStamp, NULL, 0, _outputFrequency, |
286 AudioFrame::kNormalSpeech, | 286 AudioFrame::kNormalSpeech, |
287 AudioFrame::kVadPassive, num_mixed_channels); | 287 AudioFrame::kVadPassive, num_mixed_channels); |
288 | 288 |
289 _timeStamp += static_cast<uint32_t>(_sampleSize); | 289 _timeStamp += static_cast<uint32_t>(_sampleSize); |
290 | 290 |
291 // We only use the limiter if it supports the output sample rate and | 291 // We only use the limiter if it supports the output sample rate and |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 if(error != _limiter->kNoError) { | 920 if(error != _limiter->kNoError) { |
921 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, | 921 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, |
922 "Error from AudioProcessing: %d", error); | 922 "Error from AudioProcessing: %d", error); |
923 assert(false); | 923 assert(false); |
924 return false; | 924 return false; |
925 } | 925 } |
926 return true; | 926 return true; |
927 } | 927 } |
928 } // namespace webrtc | 928 } // namespace webrtc |
OLD | NEW |