OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // TODO(yujo): make resampler take an AudioFrame, and add special case | 28 // TODO(yujo): make resampler take an AudioFrame, and add special case |
29 // handling of muted frames. | 29 // handling of muted frames. |
30 return resampler->Resample( | 30 return resampler->Resample( |
31 frame.data(), frame.samples_per_channel_ * number_of_channels, | 31 frame.data(), frame.samples_per_channel_ * number_of_channels, |
32 destination, number_of_channels * target_number_of_samples_per_channel); | 32 destination, number_of_channels * target_number_of_samples_per_channel); |
33 } | 33 } |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 AudioTransportProxy::AudioTransportProxy(AudioTransport* voe_audio_transport, | 36 AudioTransportProxy::AudioTransportProxy(AudioTransport* voe_audio_transport, |
37 AudioProcessing* apm, | 37 AudioProcessing* audio_processing, |
38 AudioMixer* mixer) | 38 AudioMixer* mixer) |
39 : voe_audio_transport_(voe_audio_transport), apm_(apm), mixer_(mixer) { | 39 : voe_audio_transport_(voe_audio_transport), |
| 40 audio_processing_(audio_processing), |
| 41 mixer_(mixer) { |
40 RTC_DCHECK(voe_audio_transport); | 42 RTC_DCHECK(voe_audio_transport); |
41 RTC_DCHECK(apm); | 43 RTC_DCHECK(audio_processing); |
42 RTC_DCHECK(mixer); | 44 RTC_DCHECK(mixer); |
43 } | 45 } |
44 | 46 |
45 AudioTransportProxy::~AudioTransportProxy() {} | 47 AudioTransportProxy::~AudioTransportProxy() {} |
46 | 48 |
47 int32_t AudioTransportProxy::RecordedDataIsAvailable( | 49 int32_t AudioTransportProxy::RecordedDataIsAvailable( |
48 const void* audioSamples, | 50 const void* audioSamples, |
49 const size_t nSamples, | 51 const size_t nSamples, |
50 const size_t nBytesPerSample, | 52 const size_t nBytesPerSample, |
51 const size_t nChannels, | 53 const size_t nChannels, |
(...skipping 26 matching lines...) Expand all Loading... |
78 | 80 |
79 // 100 = 1 second / data duration (10 ms). | 81 // 100 = 1 second / data duration (10 ms). |
80 RTC_DCHECK_EQ(nSamples * 100, samplesPerSec); | 82 RTC_DCHECK_EQ(nSamples * 100, samplesPerSec); |
81 RTC_DCHECK_LE(nBytesPerSample * nSamples * nChannels, | 83 RTC_DCHECK_LE(nBytesPerSample * nSamples * nChannels, |
82 AudioFrame::kMaxDataSizeBytes); | 84 AudioFrame::kMaxDataSizeBytes); |
83 | 85 |
84 mixer_->Mix(nChannels, &mixed_frame_); | 86 mixer_->Mix(nChannels, &mixed_frame_); |
85 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_; | 87 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_; |
86 *ntp_time_ms = mixed_frame_.ntp_time_ms_; | 88 *ntp_time_ms = mixed_frame_.ntp_time_ms_; |
87 | 89 |
88 const auto error = apm_->ProcessReverseStream(&mixed_frame_); | 90 const auto error = audio_processing_->ProcessReverseStream(&mixed_frame_); |
89 RTC_DCHECK_EQ(error, AudioProcessing::kNoError); | 91 RTC_DCHECK_EQ(error, AudioProcessing::kNoError); |
90 | 92 |
91 nSamplesOut = Resample(mixed_frame_, samplesPerSec, &resampler_, | 93 nSamplesOut = Resample(mixed_frame_, samplesPerSec, &resampler_, |
92 static_cast<int16_t*>(audioSamples)); | 94 static_cast<int16_t*>(audioSamples)); |
93 RTC_DCHECK_EQ(nSamplesOut, nChannels * nSamples); | 95 RTC_DCHECK_EQ(nSamplesOut, nChannels * nSamples); |
94 return 0; | 96 return 0; |
95 } | 97 } |
96 | 98 |
97 void AudioTransportProxy::PushCaptureData(int voe_channel, | 99 void AudioTransportProxy::PushCaptureData(int voe_channel, |
98 const void* audio_data, | 100 const void* audio_data, |
(...skipping 27 matching lines...) Expand all Loading... |
126 mixer_->Mix(number_of_channels, &mixed_frame_); | 128 mixer_->Mix(number_of_channels, &mixed_frame_); |
127 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_; | 129 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_; |
128 *ntp_time_ms = mixed_frame_.ntp_time_ms_; | 130 *ntp_time_ms = mixed_frame_.ntp_time_ms_; |
129 | 131 |
130 const auto output_samples = Resample(mixed_frame_, sample_rate, &resampler_, | 132 const auto output_samples = Resample(mixed_frame_, sample_rate, &resampler_, |
131 static_cast<int16_t*>(audio_data)); | 133 static_cast<int16_t*>(audio_data)); |
132 RTC_DCHECK_EQ(output_samples, number_of_channels * number_of_frames); | 134 RTC_DCHECK_EQ(output_samples, number_of_channels * number_of_frames); |
133 } | 135 } |
134 | 136 |
135 } // namespace webrtc | 137 } // namespace webrtc |
OLD | NEW |