aleloi | dd31071 | 2016-11-17 06:28:59 -0800 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef AUDIO_AUDIO_TRANSPORT_PROXY_H_ |
| 12 | #define AUDIO_AUDIO_TRANSPORT_PROXY_H_ |
aleloi | dd31071 | 2016-11-17 06:28:59 -0800 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "api/audio/audio_mixer.h" |
| 15 | #include "common_audio/resampler/include/push_resampler.h" |
| 16 | #include "modules/audio_device/include/audio_device_defines.h" |
| 17 | #include "modules/audio_processing/include/audio_processing.h" |
| 18 | #include "rtc_base/constructormagic.h" |
| 19 | #include "rtc_base/scoped_ref_ptr.h" |
aleloi | dd31071 | 2016-11-17 06:28:59 -0800 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | class AudioTransportProxy : public AudioTransport { |
| 24 | public: |
| 25 | AudioTransportProxy(AudioTransport* voe_audio_transport, |
peah | a9cc40b | 2017-06-29 08:32:09 -0700 | [diff] [blame] | 26 | AudioProcessing* audio_processing, |
aleloi | dd31071 | 2016-11-17 06:28:59 -0800 | [diff] [blame] | 27 | AudioMixer* mixer); |
| 28 | |
| 29 | ~AudioTransportProxy() override; |
| 30 | |
| 31 | int32_t RecordedDataIsAvailable(const void* audioSamples, |
| 32 | const size_t nSamples, |
| 33 | const size_t nBytesPerSample, |
| 34 | const size_t nChannels, |
| 35 | const uint32_t samplesPerSec, |
| 36 | const uint32_t totalDelayMS, |
| 37 | const int32_t clockDrift, |
| 38 | const uint32_t currentMicLevel, |
| 39 | const bool keyPressed, |
| 40 | uint32_t& newMicLevel) override; |
| 41 | |
| 42 | int32_t NeedMorePlayData(const size_t nSamples, |
| 43 | const size_t nBytesPerSample, |
| 44 | const size_t nChannels, |
| 45 | const uint32_t samplesPerSec, |
| 46 | void* audioSamples, |
| 47 | size_t& nSamplesOut, |
| 48 | int64_t* elapsed_time_ms, |
| 49 | int64_t* ntp_time_ms) override; |
| 50 | |
| 51 | void PushCaptureData(int voe_channel, |
| 52 | const void* audio_data, |
| 53 | int bits_per_sample, |
| 54 | int sample_rate, |
| 55 | size_t number_of_channels, |
| 56 | size_t number_of_frames) override; |
| 57 | |
| 58 | void PullRenderData(int bits_per_sample, |
| 59 | int sample_rate, |
| 60 | size_t number_of_channels, |
| 61 | size_t number_of_frames, |
| 62 | void* audio_data, |
| 63 | int64_t* elapsed_time_ms, |
| 64 | int64_t* ntp_time_ms) override; |
| 65 | |
| 66 | private: |
| 67 | AudioTransport* voe_audio_transport_; |
peah | a9cc40b | 2017-06-29 08:32:09 -0700 | [diff] [blame] | 68 | AudioProcessing* audio_processing_; |
aleloi | 04c0722 | 2016-11-22 06:42:53 -0800 | [diff] [blame] | 69 | rtc::scoped_refptr<AudioMixer> mixer_; |
| 70 | AudioFrame mixed_frame_; |
| 71 | // Converts mixed audio to the audio device output rate. |
| 72 | PushResampler<int16_t> resampler_; |
aleloi | dd31071 | 2016-11-17 06:28:59 -0800 | [diff] [blame] | 73 | |
| 74 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTransportProxy); |
| 75 | }; |
| 76 | } // namespace webrtc |
| 77 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 78 | #endif // AUDIO_AUDIO_TRANSPORT_PROXY_H_ |