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 ...
随机推荐
- webapp之路--之必备知识
移动设备的用户越来越多,每天android手机的激活量都已经超过130万台,所以我们面向移动终端的WebAPP也开始跟进了.本文主要介绍webapp的开发与调试的相关知识和经验,以及给出几种可选的解决 ...
- Python异常处理体系
1.Python内建异常体系结构 The class hierarchy for built-in exceptions is: BaseException +-- SystemExit +-- ...
- Linux:crontab的安装以及使用方法
安装crontab: [root@wulaoer ~]# yum install vixie-cron [root@wulaoer ~]# yum install crontabs 说明:vixie- ...
- Windows Server 2012 在个人终端上使用的推荐设置
Windows Server 2012,也就是 Windows 8 的服务器版本,相对于 Windows 8 企业版而言,增强了作为服务器的功能,弱化了作为终端系统的功能. 目前微软官方提供了 Win ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem D
排个序,map直接搞. #include <stdio.h> #include <math.h> #include<cstring> #include<cma ...
- flex中form表单中子元素之间的距离控制
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.ado ...
- php解决微信开发中用户昵称中的特殊字符与emoji表情写入mysql错误的问题
解决办法:将3个字节的特殊字符与emoji表情替换掉即可. $nickname = preg_replace('/xE0[x80-x9F][x80-xBF]'.'|xED[xA0-xBF][x80-x ...
- Education Round16
A题:题意:给定国际象棋king的坐标,求能向几个方向移动分析:处理一下边界情况,其他的都是8 #include <iostream> #include <cstdio> #i ...
- (简单) POJ 2253 Frogger,Dijkstra。
Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Fro ...
- RestTemplate 发送Post 多个参数请求
MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<>(); requestEntity ...