Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 } | 34 } |
| 35 | 35 |
| 36 void RemixAndResample(const int16_t* src_data, | 36 void RemixAndResample(const int16_t* src_data, |
| 37 size_t samples_per_channel, | 37 size_t samples_per_channel, |
| 38 size_t num_channels, | 38 size_t num_channels, |
| 39 int sample_rate_hz, | 39 int sample_rate_hz, |
| 40 PushResampler<int16_t>* resampler, | 40 PushResampler<int16_t>* resampler, |
| 41 AudioFrame* dst_frame) { | 41 AudioFrame* dst_frame) { |
| 42 const int16_t* audio_ptr = src_data; | 42 const int16_t* audio_ptr = src_data; |
| 43 size_t audio_ptr_num_channels = num_channels; | 43 size_t audio_ptr_num_channels = num_channels; |
| 44 int16_t downsampled_audio[AudioFrame::kMaxDataSizeSamples]; | 44 int16_t downsmixed_audio[AudioFrame::kMaxDataSizeSamples]; |
|
ossu
2017/07/07 11:14:42
Perhaps take a closer look at what you actually re
| |
| 45 | 45 |
| 46 // Downmix before resampling. | 46 // Downmix before resampling. |
| 47 if (num_channels > dst_frame->num_channels_) { | 47 if (num_channels > dst_frame->num_channels_) { |
| 48 RTC_DCHECK(num_channels == 2 || num_channels == 4) | 48 RTC_DCHECK(num_channels == 2 || num_channels == 4) |
| 49 << "num_channels: " << num_channels; | 49 << "num_channels: " << num_channels; |
| 50 RTC_DCHECK(dst_frame->num_channels_ == 1 || dst_frame->num_channels_ == 2) | 50 RTC_DCHECK(dst_frame->num_channels_ == 1 || dst_frame->num_channels_ == 2) |
| 51 << "dst_frame->num_channels_: " << dst_frame->num_channels_; | 51 << "dst_frame->num_channels_: " << dst_frame->num_channels_; |
| 52 | 52 |
| 53 AudioFrameOperations::DownmixChannels( | 53 AudioFrameOperations::DownmixChannels( |
| 54 src_data, num_channels, samples_per_channel, dst_frame->num_channels_, | 54 src_data, num_channels, samples_per_channel, dst_frame->num_channels_, |
| 55 downsampled_audio); | 55 downsmixed_audio); |
| 56 audio_ptr = downsampled_audio; | 56 audio_ptr = downsmixed_audio; |
| 57 audio_ptr_num_channels = dst_frame->num_channels_; | 57 audio_ptr_num_channels = dst_frame->num_channels_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_, | 60 if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_, |
| 61 audio_ptr_num_channels) == -1) { | 61 audio_ptr_num_channels) == -1) { |
| 62 FATAL() << "InitializeIfNeeded failed: sample_rate_hz = " << sample_rate_hz | 62 FATAL() << "InitializeIfNeeded failed: sample_rate_hz = " << sample_rate_hz |
| 63 << ", dst_frame->sample_rate_hz_ = " << dst_frame->sample_rate_hz_ | 63 << ", dst_frame->sample_rate_hz_ = " << dst_frame->sample_rate_hz_ |
| 64 << ", audio_ptr_num_channels = " << audio_ptr_num_channels; | 64 << ", audio_ptr_num_channels = " << audio_ptr_num_channels; |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 int32_t temp = 0; | 114 int32_t temp = 0; |
| 115 for (size_t i = 0; i < source_len; ++i) { | 115 for (size_t i = 0; i < source_len; ++i) { |
| 116 temp = source[i] + target[i]; | 116 temp = source[i] + target[i]; |
| 117 target[i] = WebRtcSpl_SatW32ToW16(temp); | 117 target[i] = WebRtcSpl_SatW32ToW16(temp); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace voe | 122 } // namespace voe |
| 123 } // namespace webrtc | 123 } // namespace webrtc |
| OLD | NEW |