Google收购的GIPS公司的音频处理技术是很牛的,如今开源了,这么好的技术应该拿来用的,这里就简单的介绍一下怎样使用VoiceEngine,欢迎你们拍砖指导。web
WebRTC相关的VideoEngine和VoiceEngine的API详细说明文档:http://www.webrtc.org/system/app/pages/subPages?path=/reference/webrtc-internals算法
WebRTC的VideoEngine和VoiceEngine源码在:http://code.google.com/p/webrtc/source/browse/#svn%2Fbranches网络
iSAC(Internet Speech Audio Codec 互联网语音音频编解码器)相关编码的参数:app
取样频率16kHz、24kHz或32kHz,自适应速率为10kbit/s至52kbit/s,自适应包大小为30至60ms,因为算法复杂度和自适应可变速率,相比于G.722.2每帧延时3ms左右。
ide
关于如何配置iSAC的参数,能够参看这里文章的介绍。svn
当前的版本VideoEngine是:ViE3.1.0oop
VoiceEngine是:VoE4.1.0this
-
-
-
- VoiceEngine* _voiceEngine;
- VoEBase* _veBase;
- VoENetwork* _veNetwork;
- VoECodec* _veCodec;
- VoERTP_RTCP* _veRTCP;
-
- _voiceEngine = VoiceEngine::Create();
-
- _veBase = VoEBase::GetInterface(_voiceEngine);
- _veNetwork = VoENetwork::GetInterface(_voiceEngine);
- _veCodec = VoECodec::GetInterface(_voiceEngine);
- _veRTCP = VoERTP_RTCP::GetInterface(_voiceEngine);
- _vieBase->SetVoiceEngine(_voiceEngine);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CodecInst voiceCodec;
-
- strcpy(voiceCodec.plname, "ISAC");
- voiceCodec.plfreq = 16000;
- voiceCodec.pltype = 103;
- voiceCodec.pacsize = 480;
- voiceCodec.channels = 1;
- voiceCodec.rate = -1;
-
- int numOfVeCodecs = _veCodec->NumOfCodecs();
- for(int i=0; i<numOfVeCodecs;++i)
- {
- if(_veCodec->GetCodec(i,voiceCodec)!=-1)
- {
- if(strncmp(voiceCodec.plname,"ISAC",4)==0)
- break;
- }
- }
-
-
- _audioChannel = _veBase->CreateChannel();
- _veRTCP->SetRTCPStatus(_audioChannel, true);
- _veCodec->SetSendCodec(_audioChannel, voiceCodec);
- _veBase->StartPlayout(_audioChannel);
-
-
- _vieBase->ConnectAudioChannel(_channelId,_audioChannel);
-
-
- _veBase->SetSendDestination(_audioChannel, remotePort,IP);
-
- int res=_veBase->SetLocalReceiver(_audioChannel,localPort);
-
- _veBase->StartSend(_audioChannel);
- _veBase->StartReceive(_audioChannel);
-
- _veBase->StopReceive(_audioChannel);
- _veBase->StopSend(_audioChannel);
-
-
- if (_voiceEngine)
- {
- _veBase->DeleteChannel(_audioChannel);
- _veBase->Release();
- _veNetwork->Release();
- _veCodec->Release();
- _veRTCP->Release();
-
- VoiceEngine::Delete(_voiceEngine);
- }