blob: 7f68f5101a180e45079cafb3fdceaa11f007ae5d [file] [log] [blame]
solenberg13725082015-11-25 08:16:52 -08001/*
2 * Copyright (c) 2015 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#include "webrtc/voice_engine/channel_proxy.h"
12
Tommif888bb52015-12-12 01:37:01 +010013#include <utility>
14
kjellandera69d9732016-08-31 07:33:05 -070015#include "webrtc/api/call/audio_sink.h"
solenberg13725082015-11-25 08:16:52 -080016#include "webrtc/base/checks.h"
17#include "webrtc/voice_engine/channel.h"
18
19namespace webrtc {
20namespace voe {
21ChannelProxy::ChannelProxy() : channel_owner_(nullptr) {}
22
23ChannelProxy::ChannelProxy(const ChannelOwner& channel_owner) :
24 channel_owner_(channel_owner) {
25 RTC_CHECK(channel_owner_.channel());
solenberg08b19df2017-02-15 00:42:31 -080026 module_process_thread_checker_.DetachFromThread();
solenberg13725082015-11-25 08:16:52 -080027}
28
Tommif888bb52015-12-12 01:37:01 +010029ChannelProxy::~ChannelProxy() {}
30
solenberg13725082015-11-25 08:16:52 -080031void ChannelProxy::SetRTCPStatus(bool enable) {
solenberg08b19df2017-02-15 00:42:31 -080032 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -080033 channel()->SetRTCPStatus(enable);
solenberg13725082015-11-25 08:16:52 -080034}
35
36void ChannelProxy::SetLocalSSRC(uint32_t ssrc) {
solenberg08b19df2017-02-15 00:42:31 -080037 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -080038 int error = channel()->SetLocalSSRC(ssrc);
solenberg13725082015-11-25 08:16:52 -080039 RTC_DCHECK_EQ(0, error);
40}
41
42void ChannelProxy::SetRTCP_CNAME(const std::string& c_name) {
solenberg08b19df2017-02-15 00:42:31 -080043 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg13725082015-11-25 08:16:52 -080044 // Note: VoERTP_RTCP::SetRTCP_CNAME() accepts a char[256] array.
45 std::string c_name_limited = c_name.substr(0, 255);
solenberg358057b2015-11-27 10:46:42 -080046 int error = channel()->SetRTCP_CNAME(c_name_limited.c_str());
solenberg13725082015-11-25 08:16:52 -080047 RTC_DCHECK_EQ(0, error);
48}
solenberg358057b2015-11-27 10:46:42 -080049
solenberg971cab02016-06-14 10:02:41 -070050void ChannelProxy::SetNACKStatus(bool enable, int max_packets) {
solenberg08b19df2017-02-15 00:42:31 -080051 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg971cab02016-06-14 10:02:41 -070052 channel()->SetNACKStatus(enable, max_packets);
53}
54
solenberg358057b2015-11-27 10:46:42 -080055void ChannelProxy::SetSendAudioLevelIndicationStatus(bool enable, int id) {
solenberg08b19df2017-02-15 00:42:31 -080056 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -080057 int error = channel()->SetSendAudioLevelIndicationStatus(enable, id);
58 RTC_DCHECK_EQ(0, error);
59}
60
solenberg358057b2015-11-27 10:46:42 -080061void ChannelProxy::SetReceiveAudioLevelIndicationStatus(bool enable, int id) {
solenberg08b19df2017-02-15 00:42:31 -080062 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -080063 int error = channel()->SetReceiveAudioLevelIndicationStatus(enable, id);
64 RTC_DCHECK_EQ(0, error);
65}
66
stefan3313ec92016-01-21 06:32:43 -080067void ChannelProxy::EnableSendTransportSequenceNumber(int id) {
solenberg08b19df2017-02-15 00:42:31 -080068 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
stefan3313ec92016-01-21 06:32:43 -080069 channel()->EnableSendTransportSequenceNumber(id);
70}
71
72void ChannelProxy::EnableReceiveTransportSequenceNumber(int id) {
solenberg08b19df2017-02-15 00:42:31 -080073 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
stefan3313ec92016-01-21 06:32:43 -080074 channel()->EnableReceiveTransportSequenceNumber(id);
75}
76
stefanbba9dec2016-02-01 04:39:55 -080077void ChannelProxy::RegisterSenderCongestionControlObjects(
Stefan Holmerb86d4e42015-12-07 10:26:18 +010078 RtpPacketSender* rtp_packet_sender,
79 TransportFeedbackObserver* transport_feedback_observer,
stefan7de8d642017-02-07 07:14:08 -080080 PacketRouter* packet_router,
81 RtcpBandwidthObserver* bandwidth_observer) {
solenberg08b19df2017-02-15 00:42:31 -080082 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
stefanbba9dec2016-02-01 04:39:55 -080083 channel()->RegisterSenderCongestionControlObjects(
stefan7de8d642017-02-07 07:14:08 -080084 rtp_packet_sender, transport_feedback_observer, packet_router,
85 bandwidth_observer);
Stefan Holmerb86d4e42015-12-07 10:26:18 +010086}
87
stefanbba9dec2016-02-01 04:39:55 -080088void ChannelProxy::RegisterReceiverCongestionControlObjects(
89 PacketRouter* packet_router) {
solenberg08b19df2017-02-15 00:42:31 -080090 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
stefanbba9dec2016-02-01 04:39:55 -080091 channel()->RegisterReceiverCongestionControlObjects(packet_router);
92}
93
94void ChannelProxy::ResetCongestionControlObjects() {
solenberg08b19df2017-02-15 00:42:31 -080095 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
stefanbba9dec2016-02-01 04:39:55 -080096 channel()->ResetCongestionControlObjects();
97}
98
solenberg358057b2015-11-27 10:46:42 -080099CallStatistics ChannelProxy::GetRTCPStatistics() const {
solenberg08b19df2017-02-15 00:42:31 -0800100 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800101 CallStatistics stats = {0};
102 int error = channel()->GetRTPStatistics(stats);
103 RTC_DCHECK_EQ(0, error);
104 return stats;
105}
106
107std::vector<ReportBlock> ChannelProxy::GetRemoteRTCPReportBlocks() const {
solenberg08b19df2017-02-15 00:42:31 -0800108 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800109 std::vector<webrtc::ReportBlock> blocks;
110 int error = channel()->GetRemoteRTCPReportBlocks(&blocks);
111 RTC_DCHECK_EQ(0, error);
112 return blocks;
113}
114
115NetworkStatistics ChannelProxy::GetNetworkStatistics() const {
solenberg08b19df2017-02-15 00:42:31 -0800116 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800117 NetworkStatistics stats = {0};
118 int error = channel()->GetNetworkStatistics(stats);
119 RTC_DCHECK_EQ(0, error);
120 return stats;
121}
122
123AudioDecodingCallStats ChannelProxy::GetDecodingCallStatistics() const {
solenberg08b19df2017-02-15 00:42:31 -0800124 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800125 AudioDecodingCallStats stats;
126 channel()->GetDecodingCallStatistics(&stats);
127 return stats;
128}
129
130int32_t ChannelProxy::GetSpeechOutputLevelFullRange() const {
solenberg08b19df2017-02-15 00:42:31 -0800131 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800132 uint32_t level = 0;
133 int error = channel()->GetSpeechOutputLevelFullRange(level);
134 RTC_DCHECK_EQ(0, error);
135 return static_cast<int32_t>(level);
136}
137
138uint32_t ChannelProxy::GetDelayEstimate() const {
solenberg08b19df2017-02-15 00:42:31 -0800139 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread() ||
140 module_process_thread_checker_.CalledOnValidThread());
solenberg358057b2015-11-27 10:46:42 -0800141 return channel()->GetDelayEstimate();
142}
143
solenbergffbbcac2016-11-17 05:25:37 -0800144bool ChannelProxy::SetSendTelephoneEventPayloadType(int payload_type,
145 int payload_frequency) {
solenberg08b19df2017-02-15 00:42:31 -0800146 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergffbbcac2016-11-17 05:25:37 -0800147 return channel()->SetSendTelephoneEventPayloadType(payload_type,
148 payload_frequency) == 0;
Fredrik Solenbergb5727682015-12-04 15:22:19 +0100149}
150
solenberg8842c3e2016-03-11 03:06:41 -0800151bool ChannelProxy::SendTelephoneEventOutband(int event, int duration_ms) {
solenberg08b19df2017-02-15 00:42:31 -0800152 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg8842c3e2016-03-11 03:06:41 -0800153 return channel()->SendTelephoneEventOutband(event, duration_ms) == 0;
Fredrik Solenbergb5727682015-12-04 15:22:19 +0100154}
155
minyue78b4d562016-11-30 04:47:39 -0800156void ChannelProxy::SetBitrate(int bitrate_bps, int64_t probing_interval_ms) {
solenberg08b19df2017-02-15 00:42:31 -0800157 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread() ||
158 module_process_thread_checker_.CalledOnValidThread());
minyue78b4d562016-11-30 04:47:39 -0800159 channel()->SetBitRate(bitrate_bps, probing_interval_ms);
mflodman86cc6ff2016-07-26 04:44:06 -0700160}
161
kwibergd32bf752017-01-19 07:03:59 -0800162void ChannelProxy::SetRecPayloadType(int payload_type,
163 const SdpAudioFormat& format) {
solenberg08b19df2017-02-15 00:42:31 -0800164 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
kwibergd32bf752017-01-19 07:03:59 -0800165 const int result = channel()->SetRecPayloadType(payload_type, format);
166 RTC_DCHECK_EQ(0, result);
167}
168
kwibergb7f89d62016-02-17 10:04:18 -0800169void ChannelProxy::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
solenberg08b19df2017-02-15 00:42:31 -0800170 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
deadbeef2d110be2016-01-13 12:00:26 -0800171 channel()->SetSink(std::move(sink));
Tommif888bb52015-12-12 01:37:01 +0100172}
173
solenberg94218532016-06-16 10:53:22 -0700174void ChannelProxy::SetInputMute(bool muted) {
solenberg08b19df2017-02-15 00:42:31 -0800175 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg94218532016-06-16 10:53:22 -0700176 int error = channel()->SetInputMute(muted);
177 RTC_DCHECK_EQ(0, error);
178}
179
mflodman3d7db262016-04-29 00:57:13 -0700180void ChannelProxy::RegisterExternalTransport(Transport* transport) {
solenberg08b19df2017-02-15 00:42:31 -0800181 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
mflodman3d7db262016-04-29 00:57:13 -0700182 int error = channel()->RegisterExternalTransport(transport);
183 RTC_DCHECK_EQ(0, error);
184}
185
186void ChannelProxy::DeRegisterExternalTransport() {
solenberg08b19df2017-02-15 00:42:31 -0800187 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
mflodman3d7db262016-04-29 00:57:13 -0700188 channel()->DeRegisterExternalTransport();
189}
190
nisse657bab22017-02-21 06:28:10 -0800191void ChannelProxy::OnRtpPacket(const RtpPacketReceived& packet) {
mflodman3d7db262016-04-29 00:57:13 -0700192 // May be called on either worker thread or network thread.
nisse657bab22017-02-21 06:28:10 -0800193 channel()->OnRtpPacket(packet);
mflodman3d7db262016-04-29 00:57:13 -0700194}
195
196bool ChannelProxy::ReceivedRTCPPacket(const uint8_t* packet, size_t length) {
197 // May be called on either worker thread or network thread.
198 return channel()->ReceivedRTCPPacket(packet, length) == 0;
199}
200
ossu29b1a8d2016-06-13 07:34:51 -0700201const rtc::scoped_refptr<AudioDecoderFactory>&
solenberg217fb662016-06-17 08:30:54 -0700202 ChannelProxy::GetAudioDecoderFactory() const {
solenberg08b19df2017-02-15 00:42:31 -0800203 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
ossu29b1a8d2016-06-13 07:34:51 -0700204 return channel()->GetAudioDecoderFactory();
205}
206
solenberg217fb662016-06-17 08:30:54 -0700207void ChannelProxy::SetChannelOutputVolumeScaling(float scaling) {
solenberg08b19df2017-02-15 00:42:31 -0800208 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg217fb662016-06-17 08:30:54 -0700209 int error = channel()->SetChannelOutputVolumeScaling(scaling);
210 RTC_DCHECK_EQ(0, error);
211}
212
ivoc14d5dbe2016-07-04 07:06:55 -0700213void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) {
solenberg08b19df2017-02-15 00:42:31 -0800214 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
ivoc14d5dbe2016-07-04 07:06:55 -0700215 channel()->SetRtcEventLog(event_log);
216}
217
minyue6b825df2016-10-31 04:08:32 -0700218void ChannelProxy::EnableAudioNetworkAdaptor(const std::string& config_string) {
solenberg08b19df2017-02-15 00:42:31 -0800219 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
minyue6b825df2016-10-31 04:08:32 -0700220 bool ret = channel()->EnableAudioNetworkAdaptor(config_string);
221 RTC_DCHECK(ret);
222;}
223
224void ChannelProxy::DisableAudioNetworkAdaptor() {
solenberg08b19df2017-02-15 00:42:31 -0800225 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
minyue6b825df2016-10-31 04:08:32 -0700226 channel()->DisableAudioNetworkAdaptor();
227}
228
229void ChannelProxy::SetReceiverFrameLengthRange(int min_frame_length_ms,
230 int max_frame_length_ms) {
solenberg08b19df2017-02-15 00:42:31 -0800231 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
minyue6b825df2016-10-31 04:08:32 -0700232 channel()->SetReceiverFrameLengthRange(min_frame_length_ms,
233 max_frame_length_ms);
234}
235
aleloi6c278492016-10-20 14:24:39 -0700236AudioMixer::Source::AudioFrameInfo ChannelProxy::GetAudioFrameWithInfo(
237 int sample_rate_hz,
238 AudioFrame* audio_frame) {
solenberg08b19df2017-02-15 00:42:31 -0800239 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_);
aleloi6c278492016-10-20 14:24:39 -0700240 return channel()->GetAudioFrameWithInfo(sample_rate_hz, audio_frame);
aleloiaed581a2016-10-20 06:32:39 -0700241}
242
aleloi051f6782016-10-31 03:26:40 -0700243int ChannelProxy::NeededFrequency() const {
solenberg08b19df2017-02-15 00:42:31 -0800244 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_);
aleloi051f6782016-10-31 03:26:40 -0700245 return static_cast<int>(channel()->NeededFrequency(-1));
246}
247
michaelt79e05882016-11-08 02:50:09 -0800248void ChannelProxy::SetTransportOverhead(int transport_overhead_per_packet) {
solenberg08b19df2017-02-15 00:42:31 -0800249 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
michaelt79e05882016-11-08 02:50:09 -0800250 channel()->SetTransportOverhead(transport_overhead_per_packet);
251}
252
solenberg7602aab2016-11-14 11:30:07 -0800253void ChannelProxy::AssociateSendChannel(
254 const ChannelProxy& send_channel_proxy) {
solenberg08b19df2017-02-15 00:42:31 -0800255 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg7602aab2016-11-14 11:30:07 -0800256 channel()->set_associate_send_channel(send_channel_proxy.channel_owner_);
257}
258
259void ChannelProxy::DisassociateSendChannel() {
solenberg08b19df2017-02-15 00:42:31 -0800260 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg7602aab2016-11-14 11:30:07 -0800261 channel()->set_associate_send_channel(ChannelOwner(nullptr));
262}
263
solenberg3ebbcb52017-01-31 03:58:40 -0800264void ChannelProxy::GetRtpRtcp(RtpRtcp** rtp_rtcp,
265 RtpReceiver** rtp_receiver) const {
solenberg08b19df2017-02-15 00:42:31 -0800266 RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
solenberg3ebbcb52017-01-31 03:58:40 -0800267 RTC_DCHECK(rtp_rtcp);
268 RTC_DCHECK(rtp_receiver);
269 int error = channel()->GetRtpRtcp(rtp_rtcp, rtp_receiver);
270 RTC_DCHECK_EQ(0, error);
271}
272
solenberg3ebbcb52017-01-31 03:58:40 -0800273uint32_t ChannelProxy::GetPlayoutTimestamp() const {
solenberg08b19df2017-02-15 00:42:31 -0800274 RTC_DCHECK_RUNS_SERIALIZED(&video_capture_thread_race_checker_);
solenberg3ebbcb52017-01-31 03:58:40 -0800275 unsigned int timestamp = 0;
276 int error = channel()->GetPlayoutTimestamp(timestamp);
277 RTC_DCHECK(!error || timestamp == 0);
278 return timestamp;
279}
280
281void ChannelProxy::SetMinimumPlayoutDelay(int delay_ms) {
solenberg08b19df2017-02-15 00:42:31 -0800282 RTC_DCHECK(module_process_thread_checker_.CalledOnValidThread());
solenberg3ebbcb52017-01-31 03:58:40 -0800283 // Limit to range accepted by both VoE and ACM, so we're at least getting as
284 // close as possible, instead of failing.
285 delay_ms = std::max(0, std::min(delay_ms, 10000));
286 int error = channel()->SetMinimumPlayoutDelay(delay_ms);
287 RTC_DCHECK_EQ(0, error);
288}
289
michaelt9332b7d2016-11-30 07:51:13 -0800290void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) {
solenberg08b19df2017-02-15 00:42:31 -0800291 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
michaelt9332b7d2016-11-30 07:51:13 -0800292 channel()->SetRtcpRttStats(rtcp_rtt_stats);
293}
294
solenbergbd9a77f2017-02-06 12:53:57 -0800295bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const {
solenberg08b19df2017-02-15 00:42:31 -0800296 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800297 return channel()->GetRecCodec(*codec_inst) == 0;
298}
299
300bool ChannelProxy::GetSendCodec(CodecInst* codec_inst) const {
solenberg08b19df2017-02-15 00:42:31 -0800301 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800302 return channel()->GetSendCodec(*codec_inst) == 0;
303}
304
305bool ChannelProxy::SetVADStatus(bool enable) {
solenberg08b19df2017-02-15 00:42:31 -0800306 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800307 return channel()->SetVADStatus(enable, VADNormal, false) == 0;
308}
309
310bool ChannelProxy::SetCodecFECStatus(bool enable) {
solenberg08b19df2017-02-15 00:42:31 -0800311 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800312 return channel()->SetCodecFECStatus(enable) == 0;
313}
314
315bool ChannelProxy::SetOpusDtx(bool enable) {
solenberg08b19df2017-02-15 00:42:31 -0800316 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800317 return channel()->SetOpusDtx(enable) == 0;
318}
319
320bool ChannelProxy::SetOpusMaxPlaybackRate(int frequency_hz) {
solenberg08b19df2017-02-15 00:42:31 -0800321 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800322 return channel()->SetOpusMaxPlaybackRate(frequency_hz) == 0;
323}
324
325bool ChannelProxy::SetSendCodec(const CodecInst& codec_inst) {
solenberg08b19df2017-02-15 00:42:31 -0800326 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800327 // Validation code copied from VoECodecImpl::SetSendCodec().
328 if ((STR_CASE_CMP(codec_inst.plname, "L16") == 0) &&
329 (codec_inst.pacsize >= 960)) {
330 return false;
331 }
332 if (!STR_CASE_CMP(codec_inst.plname, "CN") ||
333 !STR_CASE_CMP(codec_inst.plname, "TELEPHONE-EVENT") ||
334 !STR_CASE_CMP(codec_inst.plname, "RED")) {
335 return false;
336 }
337 if ((codec_inst.channels != 1) && (codec_inst.channels != 2)) {
338 return false;
339 }
340 if (!AudioCodingModule::IsCodecValid(codec_inst)) {
341 return false;
342 }
343 return channel()->SetSendCodec(codec_inst) == 0;
344}
345
346bool ChannelProxy::SetSendCNPayloadType(int type,
347 PayloadFrequencies frequency) {
solenberg08b19df2017-02-15 00:42:31 -0800348 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergbd9a77f2017-02-06 12:53:57 -0800349 // Validation code copied from VoECodecImpl::SetSendCNPayloadType().
350 if (type < 96 || type > 127) {
351 // Only allow dynamic range: 96 to 127
352 return false;
353 }
354 if ((frequency != kFreq16000Hz) && (frequency != kFreq32000Hz)) {
355 // It is not possible to modify the payload type for CN/8000.
356 // We only allow modification of the CN payload type for CN/16000
357 // and CN/32000.
358 return false;
359 }
360 return channel()->SetSendCNPayloadType(type, frequency) == 0;
361}
362
solenberg358057b2015-11-27 10:46:42 -0800363Channel* ChannelProxy::channel() const {
364 RTC_DCHECK(channel_owner_.channel());
365 return channel_owner_.channel();
366}
Stefan Holmerb86d4e42015-12-07 10:26:18 +0100367
solenberg13725082015-11-25 08:16:52 -0800368} // namespace voe
369} // namespace webrtc