WebRtc 音频编码器

WebRtcVoiceEngine在初始化时收集了当前支持的编码器列表,其步骤如下:

void WebRtcVoiceEngine::Init()
{
	send_codecs_ = CollectCodecs(encoder_factory_->GetSupportedEncoders());
}

获编码器工厂支持的编码方式

encoder_factory_->GetSupportedEncoders()  见 builtin_audio_encoder_factory.cc


rtc::scoped_refptr CreateBuiltinAudioEncoderFactory()
{
	return CreateAudioEncoderFactory<

#if WEBRTC_USE_BUILTIN_OPUS
      AudioEncoderOpus,
#endif

      AudioEncoderIsac, AudioEncoderG722,

#if WEBRTC_USE_BUILTIN_ILBC
      AudioEncoderIlbc,
#endif

      AudioEncoderG711, NotAdvertised>();
}
}

最后增加 kDtmfCodecName[] = "telephone-event"

AudioCodecs WebRtcVoiceEngine::CollectCodecs(const std::vector& specs)
{
	...
	...

	// Add telephone-event codecs last.
  	for (const auto& dtmf : generate_dtmf)
  	{
    	if (dtmf.second)
    	{
      		map_format({kDtmfCodecName, dtmf.first, 1}, &out);
    	}
  	}
}

 

你可能感兴趣的:(webrtc)