1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*/
#ifndef DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H
#define DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H
#include "audio_webrtc_config.h"
#include <webrtc/audio_device.h>
class AudioTransportImpl: public webrtc::AudioTransport
{
public:
virtual WebRtc_Word32
RecordedDataIsAvailable(const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
const WebRtc_UWord32 totalDelayMS,
const WebRtc_Word32 clockDrift,
const WebRtc_UWord32 currentMicLevel,
WebRtc_UWord32& newMicLevel);
virtual WebRtc_Word32 NeedMorePlayData(const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
void* audioSamples,
WebRtc_UWord32& nSamplesOut);
AudioTransportImpl(webrtc::AudioDeviceModule* audioDevice);
~AudioTransportImpl();
public:
void SetFullDuplex(bool enable);
void SetSpeakerVolume(bool enable) {
_speakerVolume = enable;
}
;
void SetSpeakerMute(bool enable) {
_speakerMute = enable;
}
;
void SetMicrophoneMute(bool enable) {
_microphoneMute = enable;
}
;
void SetMicrophoneVolume(bool enable) {
_microphoneVolume = enable;
}
;
void SetMicrophoneBoost(bool enable) {
_microphoneBoost = enable;
}
;
void SetLoopbackMeasurements(bool enable) {
_loopBackMeasurements = enable;
}
;
void SetMicrophoneAGC(bool enable) {
_microphoneAGC = enable;
}
;
void SetConsumer(const struct audio_consumer_webrtc_s* consumer) {
_consumer = consumer;
}
;
void SetProducer(const struct audio_producer_webrtc_s* producer) {
_producer = producer;
}
;
private:
webrtc::AudioDeviceModule* _audioDevice;
const struct audio_consumer_webrtc_s* _consumer; // mut be const and must not take reference
const struct audio_producer_webrtc_s* _producer; // mut be const and must not take reference
bool _fullDuplex;
bool _speakerVolume;
bool _speakerMute;
bool _microphoneVolume;
bool _microphoneMute;
bool _microphoneBoost;
bool _microphoneAGC;
bool _loopBackMeasurements;
};
#endif /* DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H */
|