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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 const AudioFrame* ptr_frame; | 317 const AudioFrame* ptr_frame; |
318 // Perform a resampling, also down-mix if it is required and can be | 318 // Perform a resampling, also down-mix if it is required and can be |
319 // performed before resampling (a down mix prior to resampling will take | 319 // performed before resampling (a down mix prior to resampling will take |
320 // place if both primary and secondary encoders are mono and input is in | 320 // place if both primary and secondary encoders are mono and input is in |
321 // stereo). | 321 // stereo). |
322 if (PreprocessToAddData(audio_frame, &ptr_frame) < 0) { | 322 if (PreprocessToAddData(audio_frame, &ptr_frame) < 0) { |
323 return -1; | 323 return -1; |
324 } | 324 } |
325 | 325 |
326 // Check whether we need an up-mix or down-mix? | 326 // Check whether we need an up-mix or down-mix? |
327 const int current_num_channels = | 327 const size_t current_num_channels = |
328 rent_a_codec_.GetEncoderStack()->NumChannels(); | 328 rent_a_codec_.GetEncoderStack()->NumChannels(); |
329 const bool same_num_channels = | 329 const bool same_num_channels = |
330 ptr_frame->num_channels_ == current_num_channels; | 330 ptr_frame->num_channels_ == current_num_channels; |
331 | 331 |
332 if (!same_num_channels) { | 332 if (!same_num_channels) { |
333 if (ptr_frame->num_channels_ == 1) { | 333 if (ptr_frame->num_channels_ == 1) { |
334 if (UpMix(*ptr_frame, WEBRTC_10MS_PCM_AUDIO, input_data->buffer) < 0) | 334 if (UpMix(*ptr_frame, WEBRTC_10MS_PCM_AUDIO, input_data->buffer) < 0) |
335 return -1; | 335 return -1; |
336 } else { | 336 } else { |
337 if (DownMix(*ptr_frame, WEBRTC_10MS_PCM_AUDIO, input_data->buffer) < 0) | 337 if (DownMix(*ptr_frame, WEBRTC_10MS_PCM_AUDIO, input_data->buffer) < 0) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, | 582 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, |
583 "PlayoutFrequency()"); | 583 "PlayoutFrequency()"); |
584 return receiver_.last_output_sample_rate_hz(); | 584 return receiver_.last_output_sample_rate_hz(); |
585 } | 585 } |
586 | 586 |
587 // Register possible receive codecs, can be called multiple times, | 587 // Register possible receive codecs, can be called multiple times, |
588 // for codecs, CNG (NB, WB and SWB), DTMF, RED. | 588 // for codecs, CNG (NB, WB and SWB), DTMF, RED. |
589 int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) { | 589 int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) { |
590 CriticalSectionScoped lock(acm_crit_sect_.get()); | 590 CriticalSectionScoped lock(acm_crit_sect_.get()); |
591 RTC_DCHECK(receiver_initialized_); | 591 RTC_DCHECK(receiver_initialized_); |
592 if (codec.channels > 2 || codec.channels < 0) { | 592 if (codec.channels > 2) { |
593 LOG_F(LS_ERROR) << "Unsupported number of channels: " << codec.channels; | 593 LOG_F(LS_ERROR) << "Unsupported number of channels: " << codec.channels; |
594 return -1; | 594 return -1; |
595 } | 595 } |
596 | 596 |
597 auto codec_id = | 597 auto codec_id = |
598 RentACodec::CodecIdByParams(codec.plname, codec.plfreq, codec.channels); | 598 RentACodec::CodecIdByParams(codec.plname, codec.plfreq, codec.channels); |
599 if (!codec_id) { | 599 if (!codec_id) { |
600 LOG_F(LS_ERROR) << "Wrong codec params to be registered as receive codec"; | 600 LOG_F(LS_ERROR) << "Wrong codec params to be registered as receive codec"; |
601 return -1; | 601 return -1; |
602 } | 602 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 return receiver_.LeastRequiredDelayMs(); | 819 return receiver_.LeastRequiredDelayMs(); |
820 } | 820 } |
821 | 821 |
822 void AudioCodingModuleImpl::GetDecodingCallStatistics( | 822 void AudioCodingModuleImpl::GetDecodingCallStatistics( |
823 AudioDecodingCallStats* call_stats) const { | 823 AudioDecodingCallStats* call_stats) const { |
824 receiver_.GetDecodingCallStatistics(call_stats); | 824 receiver_.GetDecodingCallStatistics(call_stats); |
825 } | 825 } |
826 | 826 |
827 } // namespace acm2 | 827 } // namespace acm2 |
828 } // namespace webrtc | 828 } // namespace webrtc |
OLD | NEW |