OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/audio/audio_transport_proxy.h" |
| 12 |
| 13 namespace webrtc { |
| 14 |
| 15 int32_t AudioTransportProxy::NeedMorePlayData(const size_t nSamples, |
| 16 const size_t nBytesPerSample, |
| 17 const size_t nChannels, |
| 18 const uint32_t samplesPerSec, |
| 19 void* audioSamples, |
| 20 size_t& nSamplesOut, |
| 21 int64_t* elapsed_time_ms, |
| 22 int64_t* ntp_time_ms) { |
| 23 RTC_DCHECK_EQ(sizeof(int16_t) * nChannels, nBytesPerSample); |
| 24 RTC_DCHECK_GE(nChannels, 1u); |
| 25 RTC_DCHECK_LE(nChannels, 2u); |
| 26 RTC_DCHECK_GE( |
| 27 samplesPerSec, |
| 28 static_cast<uint32_t>(AudioProcessing::NativeRate::kSampleRate8kHz)); |
| 29 RTC_DCHECK_EQ(nSamples * 100, samplesPerSec); |
| 30 RTC_DCHECK_LE(nBytesPerSample * nSamples * nChannels, |
| 31 sizeof(AudioFrame::data_)); |
| 32 |
| 33 // Pass call through to original audio transport instance. |
| 34 return voe_audio_transport_->NeedMorePlayData( |
| 35 nSamples, nBytesPerSample, nChannels, samplesPerSec, audioSamples, |
| 36 nSamplesOut, elapsed_time_ms, ntp_time_ms); |
| 37 } |
| 38 |
| 39 void AudioTransportProxy::PullRenderData(int bits_per_sample, |
| 40 int sample_rate, |
| 41 size_t number_of_channels, |
| 42 size_t number_of_frames, |
| 43 void* audio_data, |
| 44 int64_t* elapsed_time_ms, |
| 45 int64_t* ntp_time_ms) { |
| 46 RTC_DCHECK_EQ(static_cast<size_t>(bits_per_sample), 8 * sizeof(int16_t)); |
| 47 RTC_DCHECK_GE(number_of_channels, 1u); |
| 48 RTC_DCHECK_LE(number_of_channels, 2u); |
| 49 RTC_DCHECK_GE(static_cast<int>(sample_rate), |
| 50 AudioProcessing::NativeRate::kSampleRate8kHz); |
| 51 RTC_DCHECK_EQ(static_cast<int>(number_of_frames * 100), sample_rate); |
| 52 RTC_DCHECK_LE(bits_per_sample / 8 * number_of_frames * number_of_channels, |
| 53 sizeof(AudioFrame::data_)); |
| 54 voe_audio_transport_->PullRenderData( |
| 55 bits_per_sample, sample_rate, number_of_channels, number_of_frames, |
| 56 audio_data, elapsed_time_ms, ntp_time_ms); |
| 57 } |
| 58 |
| 59 } // namespace webrtc |
OLD | NEW |