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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void ChannelProxy::SetChannelOutputVolumeScaling(float scaling) { | 219 void ChannelProxy::SetChannelOutputVolumeScaling(float scaling) { |
220 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 220 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
221 channel()->SetChannelOutputVolumeScaling(scaling); | 221 channel()->SetChannelOutputVolumeScaling(scaling); |
222 } | 222 } |
223 | 223 |
224 void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) { | 224 void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) { |
225 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 225 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
226 channel()->SetRtcEventLog(event_log); | 226 channel()->SetRtcEventLog(event_log); |
227 } | 227 } |
228 | 228 |
229 void ChannelProxy::EnableAudioNetworkAdaptor(const std::string& config_string) { | |
230 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
231 bool ret = channel()->EnableAudioNetworkAdaptor(config_string); | |
232 RTC_DCHECK(ret); | |
233 ;} | |
234 | |
235 void ChannelProxy::DisableAudioNetworkAdaptor() { | |
236 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
237 channel()->DisableAudioNetworkAdaptor(); | |
238 } | |
239 | |
240 void ChannelProxy::SetReceiverFrameLengthRange(int min_frame_length_ms, | |
241 int max_frame_length_ms) { | |
242 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
243 channel()->SetReceiverFrameLengthRange(min_frame_length_ms, | |
244 max_frame_length_ms); | |
245 } | |
246 | |
247 AudioMixer::Source::AudioFrameInfo ChannelProxy::GetAudioFrameWithInfo( | 229 AudioMixer::Source::AudioFrameInfo ChannelProxy::GetAudioFrameWithInfo( |
248 int sample_rate_hz, | 230 int sample_rate_hz, |
249 AudioFrame* audio_frame) { | 231 AudioFrame* audio_frame) { |
250 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_); | 232 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_); |
251 return channel()->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); | 233 return channel()->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); |
252 } | 234 } |
253 | 235 |
254 int ChannelProxy::NeededFrequency() const { | 236 int ChannelProxy::NeededFrequency() const { |
255 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_); | 237 RTC_DCHECK_RUNS_SERIALIZED(&audio_thread_race_checker_); |
256 return static_cast<int>(channel()->NeededFrequency(-1)); | 238 return static_cast<int>(channel()->NeededFrequency(-1)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { | 285 void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { |
304 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 286 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
305 channel()->SetRtcpRttStats(rtcp_rtt_stats); | 287 channel()->SetRtcpRttStats(rtcp_rtt_stats); |
306 } | 288 } |
307 | 289 |
308 bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const { | 290 bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const { |
309 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 291 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
310 return channel()->GetRecCodec(*codec_inst) == 0; | 292 return channel()->GetRecCodec(*codec_inst) == 0; |
311 } | 293 } |
312 | 294 |
313 bool ChannelProxy::GetSendCodec(CodecInst* codec_inst) const { | |
314 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
315 return channel()->GetSendCodec(*codec_inst) == 0; | |
316 } | |
317 | |
318 bool ChannelProxy::SetVADStatus(bool enable) { | |
319 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
320 return channel()->SetVADStatus(enable, VADNormal, false) == 0; | |
321 } | |
322 | |
323 bool ChannelProxy::SetCodecFECStatus(bool enable) { | |
324 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
325 return channel()->SetCodecFECStatus(enable) == 0; | |
326 } | |
327 | |
328 bool ChannelProxy::SetOpusDtx(bool enable) { | |
329 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
330 return channel()->SetOpusDtx(enable) == 0; | |
331 } | |
332 | |
333 bool ChannelProxy::SetOpusMaxPlaybackRate(int frequency_hz) { | |
334 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
335 return channel()->SetOpusMaxPlaybackRate(frequency_hz) == 0; | |
336 } | |
337 | |
338 bool ChannelProxy::SetSendCodec(const CodecInst& codec_inst) { | |
339 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
340 // Validation code copied from VoECodecImpl::SetSendCodec(). | |
341 if ((STR_CASE_CMP(codec_inst.plname, "L16") == 0) && | |
342 (codec_inst.pacsize >= 960)) { | |
343 return false; | |
344 } | |
345 if (!STR_CASE_CMP(codec_inst.plname, "CN") || | |
346 !STR_CASE_CMP(codec_inst.plname, "TELEPHONE-EVENT") || | |
347 !STR_CASE_CMP(codec_inst.plname, "RED")) { | |
348 return false; | |
349 } | |
350 if ((codec_inst.channels != 1) && (codec_inst.channels != 2)) { | |
351 return false; | |
352 } | |
353 if (!AudioCodingModule::IsCodecValid(codec_inst)) { | |
354 return false; | |
355 } | |
356 return channel()->SetSendCodec(codec_inst) == 0; | |
357 } | |
358 | |
359 bool ChannelProxy::SetSendCNPayloadType(int type, | |
360 PayloadFrequencies frequency) { | |
361 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
362 // Validation code copied from VoECodecImpl::SetSendCNPayloadType(). | |
363 if (type < 96 || type > 127) { | |
364 // Only allow dynamic range: 96 to 127 | |
365 return false; | |
366 } | |
367 if ((frequency != kFreq16000Hz) && (frequency != kFreq32000Hz)) { | |
368 // It is not possible to modify the payload type for CN/8000. | |
369 // We only allow modification of the CN payload type for CN/16000 | |
370 // and CN/32000. | |
371 return false; | |
372 } | |
373 return channel()->SetSendCNPayloadType(type, frequency) == 0; | |
374 } | |
375 | |
376 Channel* ChannelProxy::channel() const { | 295 Channel* ChannelProxy::channel() const { |
377 RTC_DCHECK(channel_owner_.channel()); | 296 RTC_DCHECK(channel_owner_.channel()); |
378 return channel_owner_.channel(); | 297 return channel_owner_.channel(); |
379 } | 298 } |
380 | 299 |
381 } // namespace voe | 300 } // namespace voe |
382 } // namespace webrtc | 301 } // namespace webrtc |
OLD | NEW |