WebRTC VoiceEngine使用简单Demo
Google收购的GIPS公司的音频处理技术是很牛的,现在开源了,这么好的技术应该拿来用的,这里就简单的介绍一下怎样使用VoiceEngine,欢迎大家拍砖指导。
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 互联网语音音频编解码器)相关编码的参数:
取样频率16kHz、24kHz或32kHz,自适应速率为10kbit/s至52kbit/s,自适应包大小为30至60ms,由于算法复杂度和自适应可变速率,相比于G.722.2每帧延时3ms左右。
关于如何配置iSAC的参数,可以参看这里文章的介绍。
当前的版本VideoEngine是:ViE3.1.0
VoiceEngine是:VoE4.1.0
- WebRTC音频引擎版本VoE4.1.0
- ***/
- //初始化VoiceEngine以及Sub_APIS
- 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:
- // Each codec supported can be described by this structure.
- /********
- struct CodecInst
- {
- int pltype;
- char plname[32];
- int plfreq;
- int pacsize;
- int channels;
- int rate;
- };********/
- CodecInst voiceCodec;
- // define iSAC codec parameters
- strcpy(voiceCodec.plname, "ISAC");
- voiceCodec.plfreq = 16000; // iSAC宽带模式
- voiceCodec.pltype = 103; // 默认动态负载类型
- voiceCodec.pacsize = 480; // 480kbps,即使用30ms的packet size
- voiceCodec.channels = 1; // 单声道
- voiceCodec.rate = -1; // 信道自适应模式,单位bps
- 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);
- //网络发送接收配置,远程端口:remotePort 目的IP:IP
- _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);
- }
WebRTC VoiceEngine使用简单Demo的更多相关文章
- WebRTC介绍及简单应用
WebRTC介绍及简单应用 WebRTC,即Web Real-Time Communication,web实时通信技术.简单地说就是在web浏览器里面引入实时通信,包括音视频通话等. WebRTC实时 ...
- WebRTC VoiceEngine综合应用示例(二)——音频通话的基本流程(转)
下面将以实现一个音频通话功能为示例详细介绍VoiceEngine的使用,在文末将附上相应源码的下载地址.这里参考的是voiceengine\voe_cmd_test. 第一步是创建VoiceEngin ...
- WebRTC VoiceEngine综合应用示例(一)——基本结构分析(转)
把自己这两天学习VoiceEngine的成果分享出来,供大家参考,有什么问题也欢迎大家指出,一起学习一起进步. 本文将对VoiceEngine的基本结构做一个分析,分析的方法是自底向上的:看一个音频编 ...
- 设计模式之单例模式的简单demo
/* * 设计模式之单例模式的简单demo */ class Single { /* * 创建一个本类对象. * 和get/set方法思想一样,类不能直接调用对象 * 所以用private限制权限 * ...
- Spring的简单demo
---------------------------------------- 开发一个Spring的简单Demo,具体的步骤如下: 1.构造一个maven项目 2.在maven项目的pom.xml ...
- 使用Spring缓存的简单Demo
使用Spring缓存的简单Demo 1. 首先创建Maven工程,在Pom中配置 <dependency> <groupId>org.springframework</g ...
- Managed DirectX中的DirectShow应用(简单Demo及源码)
阅读目录 介绍 准备工作 环境搭建 简单Demo 显示效果 其他 Demo下载 介绍 DirectX是Microsoft开发的基于Windows平台的一组API,它是为高速的实时动画渲染.交互式音乐和 ...
- angular实现了一个简单demo,angular-weibo-favorites
前面必须说一段 帮客户做了一个过渡期的项目,唯一的要求就是速度,我只是会点儿基础的php,于是就用tp帮客户做了这个项目.最近和客户架构沟通,后期想把项目重新做一下,就用现在最流行的技术,暂时想的使用 ...
- Solr配置与简单Demo[转]
Solr配置与简单Demo 简介: solr是基于Lucene Java搜索库的企业级全文搜索引擎,目前是apache的一个项目.它的官方网址在http://lucene.apache.org/sol ...
随机推荐
- c#中控制不能从一个case标签贯穿到另一个case标签
每个非空的case标签都得以break结束,肯定是两个case之间少了一个break了
- ural1650 Billionaires
Billionaires Time limit: 3.0 secondMemory limit: 64 MB You probably are aware that Moscow holds the ...
- ural1628 White Streaks
White Streaks Time limit: 1.0 secondMemory limit: 64 MB The life of every unlucky person has not onl ...
- PAT (Advanced Level) 1022. Digital Library (30)
简单模拟题. 写的时候注意一些小优化,小心TLE. #include<iostream> #include<cstring> #include<cmath> #in ...
- DWR3.0框架入门(2) —— DWR的服务器推送
DWR3.0框架入门(2) —— DWR的服务器推送 DWR 在开始本节内容之前,先来了解一下什么是服务器推送技术和DWR的推送方式. 1.服务器推送技术和DWR的推送方式 传统模式的 Web ...
- EasyUi中的datagird中a标签的click事件无法触发?(已解决)
***************************2015-10-29 21:07************************* 问题如下: datagrid最后一列编辑中有如下a标签 { f ...
- PHP 正则小解
正则表达式(Regular Expression) 正则表达式系统: 1.POSIX 2.Perl PHP中使用的regex是PCRE: NOTE:PCRE(Perl兼容正则表达式,Perl Comp ...
- (简单) POJ 3074 Sudoku, DLX+精确覆盖。
Description In the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgr ...
- iOS开发之指纹解锁
http://blog.csdn.net/hongfengkt/article/details/49868073 前一阵子一直在赶项目进度,没有太多时间写博客,现在终于空闲了,将以前欠下的博客补上来. ...
- FZU 1063 三维扫描
水题.DFS求连通块. #include<cstdio> #include<cstring> #include<cmath> #include <iomani ...