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);
- }