OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 delay_ms = std::max(0, std::min(delay_ms, 10000)); | 290 delay_ms = std::max(0, std::min(delay_ms, 10000)); |
291 int error = channel()->SetMinimumPlayoutDelay(delay_ms); | 291 int error = channel()->SetMinimumPlayoutDelay(delay_ms); |
292 RTC_DCHECK_EQ(0, error); | 292 RTC_DCHECK_EQ(0, error); |
293 } | 293 } |
294 | 294 |
295 void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { | 295 void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { |
296 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 296 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
297 channel()->SetRtcpRttStats(rtcp_rtt_stats); | 297 channel()->SetRtcpRttStats(rtcp_rtt_stats); |
298 } | 298 } |
299 | 299 |
| 300 bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const { |
| 301 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 302 return channel()->GetRecCodec(*codec_inst) == 0; |
| 303 } |
| 304 |
| 305 bool ChannelProxy::GetSendCodec(CodecInst* codec_inst) const { |
| 306 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 307 return channel()->GetSendCodec(*codec_inst) == 0; |
| 308 } |
| 309 |
| 310 bool ChannelProxy::SetVADStatus(bool enable) { |
| 311 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 312 return channel()->SetVADStatus(enable, VADNormal, false) == 0; |
| 313 } |
| 314 |
| 315 bool ChannelProxy::SetCodecFECStatus(bool enable) { |
| 316 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 317 return channel()->SetCodecFECStatus(enable) == 0; |
| 318 } |
| 319 |
| 320 bool ChannelProxy::SetOpusDtx(bool enable) { |
| 321 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 322 return channel()->SetOpusDtx(enable) == 0; |
| 323 } |
| 324 |
| 325 bool ChannelProxy::SetOpusMaxPlaybackRate(int frequency_hz) { |
| 326 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 327 return channel()->SetOpusMaxPlaybackRate(frequency_hz) == 0; |
| 328 } |
| 329 |
| 330 bool ChannelProxy::SetSendCodec(const CodecInst& codec_inst) { |
| 331 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 332 // Validation code copied from VoECodecImpl::SetSendCodec(). |
| 333 if ((STR_CASE_CMP(codec_inst.plname, "L16") == 0) && |
| 334 (codec_inst.pacsize >= 960)) { |
| 335 return false; |
| 336 } |
| 337 if (!STR_CASE_CMP(codec_inst.plname, "CN") || |
| 338 !STR_CASE_CMP(codec_inst.plname, "TELEPHONE-EVENT") || |
| 339 !STR_CASE_CMP(codec_inst.plname, "RED")) { |
| 340 return false; |
| 341 } |
| 342 if ((codec_inst.channels != 1) && (codec_inst.channels != 2)) { |
| 343 return false; |
| 344 } |
| 345 if (!AudioCodingModule::IsCodecValid(codec_inst)) { |
| 346 return false; |
| 347 } |
| 348 return channel()->SetSendCodec(codec_inst) == 0; |
| 349 } |
| 350 |
| 351 bool ChannelProxy::SetSendCNPayloadType(int type, |
| 352 PayloadFrequencies frequency) { |
| 353 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 354 // Validation code copied from VoECodecImpl::SetSendCNPayloadType(). |
| 355 if (type < 96 || type > 127) { |
| 356 // Only allow dynamic range: 96 to 127 |
| 357 return false; |
| 358 } |
| 359 if ((frequency != kFreq16000Hz) && (frequency != kFreq32000Hz)) { |
| 360 // It is not possible to modify the payload type for CN/8000. |
| 361 // We only allow modification of the CN payload type for CN/16000 |
| 362 // and CN/32000. |
| 363 return false; |
| 364 } |
| 365 return channel()->SetSendCNPayloadType(type, frequency) == 0; |
| 366 } |
| 367 |
300 Channel* ChannelProxy::channel() const { | 368 Channel* ChannelProxy::channel() const { |
301 RTC_DCHECK(channel_owner_.channel()); | 369 RTC_DCHECK(channel_owner_.channel()); |
302 return channel_owner_.channel(); | 370 return channel_owner_.channel(); |
303 } | 371 } |
304 | 372 |
305 } // namespace voe | 373 } // namespace voe |
306 } // namespace webrtc | 374 } // namespace webrtc |
OLD | NEW |