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 | |
| 11 | #ifndef WEBRTC_AUDIO_AUDIO_TRANSPORT_PROXY_H_ |
| 12 | #define WEBRTC_AUDIO_AUDIO_TRANSPORT_PROXY_H_ |
| 13 | |
| 14 | #include "webrtc/api/audio/audio_mixer.h" |
| 15 | #include "webrtc/base/constructormagic.h" |
| 16 | #include "webrtc/modules/audio_device/include/audio_device_defines.h" |
| 17 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class AudioTransportProxy : public AudioTransport { |
| 22 | public: |
| 23 | AudioTransportProxy(AudioTransport* voe_audio_transport, |
| 24 | AudioProcessing* apm, |
| 25 | AudioMixer* mixer); |
| 26 | |
| 27 | ~AudioTransportProxy() override; |
| 28 | |
| 29 | int32_t RecordedDataIsAvailable(const void* audioSamples, |
| 30 | const size_t nSamples, |
| 31 | const size_t nBytesPerSample, |
| 32 | const size_t nChannels, |
| 33 | const uint32_t samplesPerSec, |
| 34 | const uint32_t totalDelayMS, |
| 35 | const int32_t clockDrift, |
| 36 | const uint32_t currentMicLevel, |
| 37 | const bool keyPressed, |
| 38 | uint32_t& newMicLevel) override; |
| 39 | |
| 40 | int32_t NeedMorePlayData(const size_t nSamples, |
| 41 | const size_t nBytesPerSample, |
| 42 | const size_t nChannels, |
| 43 | const uint32_t samplesPerSec, |
| 44 | void* audioSamples, |
| 45 | size_t& nSamplesOut, |
| 46 | int64_t* elapsed_time_ms, |
| 47 | int64_t* ntp_time_ms) override; |
| 48 | |
| 49 | void PushCaptureData(int voe_channel, |
| 50 | const void* audio_data, |
| 51 | int bits_per_sample, |
| 52 | int sample_rate, |
| 53 | size_t number_of_channels, |
| 54 | size_t number_of_frames) override; |
| 55 | |
| 56 | void PullRenderData(int bits_per_sample, |
| 57 | int sample_rate, |
| 58 | size_t number_of_channels, |
| 59 | size_t number_of_frames, |
| 60 | void* audio_data, |
| 61 | int64_t* elapsed_time_ms, |
| 62 | int64_t* ntp_time_ms) override; |
| 63 | |
| 64 | private: |
| 65 | AudioTransport* voe_audio_transport_; |
| 66 | AudioFrame frame_for_mixing_; |
| 67 | |
| 68 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTransportProxy); |
| 69 | }; |
| 70 | } // namespace webrtc |
| 71 | |
| 72 | #endif // WEBRTC_AUDIO_AUDIO_TRANSPORT_PROXY_H_ |