OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 class CriticalSectionWrapper; | 27 class CriticalSectionWrapper; |
28 class AudioCodingImpl; | 28 class AudioCodingImpl; |
29 | 29 |
30 namespace acm2 { | 30 namespace acm2 { |
31 | 31 |
32 class ACMDTMFDetection; | 32 class ACMDTMFDetection; |
33 | 33 |
34 class AudioCodingModuleImpl : public AudioCodingModule { | 34 class AudioCodingModuleImpl final : public AudioCodingModule { |
35 public: | 35 public: |
36 friend webrtc::AudioCodingImpl; | 36 friend webrtc::AudioCodingImpl; |
37 | 37 |
38 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); | 38 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); |
39 ~AudioCodingModuleImpl() override; | 39 ~AudioCodingModuleImpl() override; |
40 | 40 |
41 ///////////////////////////////////////// | 41 ///////////////////////////////////////// |
42 // Sender | 42 // Sender |
43 // | 43 // |
44 | 44 |
45 // Reset send codec. | |
46 int ResetEncoder() override; | |
47 | |
48 // Can be called multiple times for Codec, CNG, RED. | 45 // Can be called multiple times for Codec, CNG, RED. |
49 int RegisterSendCodec(const CodecInst& send_codec) override; | 46 int RegisterSendCodec(const CodecInst& send_codec) override; |
50 | 47 |
51 void RegisterExternalSendCodec( | 48 void RegisterExternalSendCodec( |
52 AudioEncoderMutable* external_speech_encoder) override; | 49 AudioEncoderMutable* external_speech_encoder) override; |
53 | 50 |
54 // Get current send codec. | 51 // Get current send codec. |
55 int SendCodec(CodecInst* current_codec) const override; | 52 int SendCodec(CodecInst* current_codec) const override; |
56 | 53 |
57 // Get current send frequency. | 54 // Get current send frequency. |
58 int SendFrequency() const override; | 55 int SendFrequency() const override; |
59 | 56 |
60 // Get encode bit-rate. | |
61 // Adaptive rate codecs return their current encode target rate, while other | |
62 // codecs return there long-term average or their fixed rate. | |
63 int SendBitrate() const override; | |
64 | |
65 // Sets the bitrate to the specified value in bits/sec. In case the codec does | 57 // Sets the bitrate to the specified value in bits/sec. In case the codec does |
66 // not support the requested value it will choose an appropriate value | 58 // not support the requested value it will choose an appropriate value |
67 // instead. | 59 // instead. |
68 void SetBitRate(int bitrate_bps) override; | 60 void SetBitRate(int bitrate_bps) override; |
69 | 61 |
70 // Set available bandwidth, inform the encoder about the | |
71 // estimated bandwidth received from the remote party. | |
72 int SetReceivedEstimatedBandwidth(int bw) override; | |
73 | |
74 // Register a transport callback which will be | 62 // Register a transport callback which will be |
75 // called to deliver the encoded buffers. | 63 // called to deliver the encoded buffers. |
76 int RegisterTransportCallback(AudioPacketizationCallback* transport) override; | 64 int RegisterTransportCallback(AudioPacketizationCallback* transport) override; |
77 | 65 |
78 // Add 10 ms of raw (PCM) audio data to the encoder. | 66 // Add 10 ms of raw (PCM) audio data to the encoder. |
79 int Add10MsData(const AudioFrame& audio_frame) override; | 67 int Add10MsData(const AudioFrame& audio_frame) override; |
80 | 68 |
81 ///////////////////////////////////////// | 69 ///////////////////////////////////////// |
82 // (RED) Redundant Coding | 70 // (RED) Redundant Coding |
83 // | 71 // |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 105 |
118 int RegisterVADCallback(ACMVADCallback* vad_callback) override; | 106 int RegisterVADCallback(ACMVADCallback* vad_callback) override; |
119 | 107 |
120 ///////////////////////////////////////// | 108 ///////////////////////////////////////// |
121 // Receiver | 109 // Receiver |
122 // | 110 // |
123 | 111 |
124 // Initialize receiver, resets codec database etc. | 112 // Initialize receiver, resets codec database etc. |
125 int InitializeReceiver() override; | 113 int InitializeReceiver() override; |
126 | 114 |
127 // Reset the decoder state. | |
128 int ResetDecoder() override; | |
129 | |
130 // Get current receive frequency. | 115 // Get current receive frequency. |
131 int ReceiveFrequency() const override; | 116 int ReceiveFrequency() const override; |
132 | 117 |
133 // Get current playout frequency. | 118 // Get current playout frequency. |
134 int PlayoutFrequency() const override; | 119 int PlayoutFrequency() const override; |
135 | 120 |
136 // Register possible receive codecs, can be called multiple times, | 121 // Register possible receive codecs, can be called multiple times, |
137 // for codecs, CNG, DTMF, RED. | 122 // for codecs, CNG, DTMF, RED. |
138 int RegisterReceiveCodec(const CodecInst& receive_codec) override; | 123 int RegisterReceiveCodec(const CodecInst& receive_codec) override; |
139 | 124 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // TODO(turajs): DTMF playout is always activated in NetEq these APIs should | 158 // TODO(turajs): DTMF playout is always activated in NetEq these APIs should |
174 // be removed, as well as all VoE related APIs and methods. | 159 // be removed, as well as all VoE related APIs and methods. |
175 // | 160 // |
176 // Configure Dtmf playout status i.e on/off playout the incoming outband Dtmf | 161 // Configure Dtmf playout status i.e on/off playout the incoming outband Dtmf |
177 // tone. | 162 // tone. |
178 int SetDtmfPlayoutStatus(bool enable) override; | 163 int SetDtmfPlayoutStatus(bool enable) override; |
179 | 164 |
180 // Get Dtmf playout status. | 165 // Get Dtmf playout status. |
181 bool DtmfPlayoutStatus() const override; | 166 bool DtmfPlayoutStatus() const override; |
182 | 167 |
183 // Estimate the Bandwidth based on the incoming stream, needed | |
184 // for one way audio where the RTCP send the BW estimate. | |
185 // This is also done in the RTP module . | |
186 int DecoderEstimatedBandwidth() const override; | |
187 | |
188 // Set playout mode voice, fax. | 168 // Set playout mode voice, fax. |
189 int SetPlayoutMode(AudioPlayoutMode mode) override; | 169 int SetPlayoutMode(AudioPlayoutMode mode) override; |
190 | 170 |
191 // Get playout mode voice, fax. | 171 // Get playout mode voice, fax. |
192 AudioPlayoutMode PlayoutMode() const override; | 172 AudioPlayoutMode PlayoutMode() const override; |
193 | 173 |
194 // Get playout timestamp. | 174 // Get playout timestamp. |
195 int PlayoutTimestamp(uint32_t* timestamp) override; | 175 int PlayoutTimestamp(uint32_t* timestamp) override; |
196 | 176 |
197 // Get 10 milliseconds of raw audio data to play out, and | 177 // Get 10 milliseconds of raw audio data to play out, and |
198 // automatic resample to the requested frequency if > 0. | 178 // automatic resample to the requested frequency if > 0. |
199 int PlayoutData10Ms(int desired_freq_hz, AudioFrame* audio_frame) override; | 179 int PlayoutData10Ms(int desired_freq_hz, AudioFrame* audio_frame) override; |
200 | 180 |
201 ///////////////////////////////////////// | 181 ///////////////////////////////////////// |
202 // Statistics | 182 // Statistics |
203 // | 183 // |
204 | 184 |
205 int GetNetworkStatistics(NetworkStatistics* statistics) override; | 185 int GetNetworkStatistics(NetworkStatistics* statistics) override; |
206 | 186 |
207 // GET RED payload for iSAC. The method id called when 'this' ACM is | |
208 // the default ACM. | |
209 // TODO(henrik.lundin) Not used. Remove? | |
210 int REDPayloadISAC(int isac_rate, | |
211 int isac_bw_estimate, | |
212 uint8_t* payload, | |
213 int16_t* length_bytes); | |
214 | |
215 int ReplaceInternalDTXWithWebRtc(bool use_webrtc_dtx) override; | |
216 | |
217 int IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx) override; | |
218 | |
219 int SetISACMaxRate(int max_bit_per_sec) override; | 187 int SetISACMaxRate(int max_bit_per_sec) override; |
220 | 188 |
221 int SetISACMaxPayloadSize(int max_size_bytes) override; | 189 int SetISACMaxPayloadSize(int max_size_bytes) override; |
222 | 190 |
223 int ConfigISACBandwidthEstimator(int frame_size_ms, | |
224 int rate_bit_per_sec, | |
225 bool enforce_frame_size = false) override; | |
226 | |
227 int SetOpusApplication(OpusApplicationMode application) override; | 191 int SetOpusApplication(OpusApplicationMode application) override; |
228 | 192 |
229 // If current send codec is Opus, informs it about the maximum playback rate | 193 // If current send codec is Opus, informs it about the maximum playback rate |
230 // the receiver will render. | 194 // the receiver will render. |
231 int SetOpusMaxPlaybackRate(int frequency_hz) override; | 195 int SetOpusMaxPlaybackRate(int frequency_hz) override; |
232 | 196 |
233 int EnableOpusDtx() override; | 197 int EnableOpusDtx() override; |
234 | 198 |
235 int DisableOpusDtx() override; | 199 int DisableOpusDtx() override; |
236 | 200 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 int playout_frequency_hz_; | 369 int playout_frequency_hz_; |
406 // TODO(henrik.lundin): All members below this line are temporary and should | 370 // TODO(henrik.lundin): All members below this line are temporary and should |
407 // be removed after refactoring is completed. | 371 // be removed after refactoring is completed. |
408 rtc::scoped_ptr<acm2::AudioCodingModuleImpl> acm_old_; | 372 rtc::scoped_ptr<acm2::AudioCodingModuleImpl> acm_old_; |
409 CodecInst current_send_codec_; | 373 CodecInst current_send_codec_; |
410 }; | 374 }; |
411 | 375 |
412 } // namespace webrtc | 376 } // namespace webrtc |
413 | 377 |
414 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_AUDIO_CODING_MODULE_IMPL_H_ | 378 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_AUDIO_CODING_MODULE_IMPL_H_ |
OLD | NEW |