blob: a51a7dba31d7c2e6fc1044b6d98826d8203bafbd [file] [log] [blame]
aleloidd310712016-11-17 06:28:59 -08001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef AUDIO_AUDIO_TRANSPORT_PROXY_H_
12#define AUDIO_AUDIO_TRANSPORT_PROXY_H_
aleloidd310712016-11-17 06:28:59 -080013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#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"
aleloidd310712016-11-17 06:28:59 -080020
21namespace webrtc {
22
23class AudioTransportProxy : public AudioTransport {
24 public:
25 AudioTransportProxy(AudioTransport* voe_audio_transport,
peaha9cc40b2017-06-29 08:32:09 -070026 AudioProcessing* audio_processing,
aleloidd310712016-11-17 06:28:59 -080027 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_;
peaha9cc40b2017-06-29 08:32:09 -070068 AudioProcessing* audio_processing_;
aleloi04c07222016-11-22 06:42:53 -080069 rtc::scoped_refptr<AudioMixer> mixer_;
70 AudioFrame mixed_frame_;
71 // Converts mixed audio to the audio device output rate.
72 PushResampler<int16_t> resampler_;
aleloidd310712016-11-17 06:28:59 -080073
74 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTransportProxy);
75};
76} // namespace webrtc
77
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020078#endif // AUDIO_AUDIO_TRANSPORT_PROXY_H_