WebRtc 音频编码器

  • Post author:
  • Post category:其他


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

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

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

encoder_factory_->GetSupportedEncoders()  见 builtin_audio_encoder_factory.cc


rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory()
{
	return CreateAudioEncoderFactory<

#if WEBRTC_USE_BUILTIN_OPUS
      AudioEncoderOpus,
#endif

      AudioEncoderIsac, AudioEncoderG722,

#if WEBRTC_USE_BUILTIN_ILBC
      AudioEncoderIlbc,
#endif

      AudioEncoderG711, NotAdvertised<AudioEncoderL16>>();
}
}

最后增加 kDtmfCodecName[] = “telephone-event”

AudioCodecs WebRtcVoiceEngine::CollectCodecs(const std::vector<webrtc::AudioCodecSpec>& specs)
{
	...
	...

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



版权声明:本文为airmanisvip原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。