WebRTC音视频引擎研究(1)--整体架构分析
2、WebRTC架构图
![](http://my.csdn.net/uploads/201205/03/1336013710_9999.png)
面向第三方开发者的WebRTC标准API(Javascript),使开发者能够容易地开发出类似于网络视频聊天的web应用,最新的标准化进程可以查看这里。
(3) WebRTC Native C++ API
本地C++ API层,使浏览器厂商容易实现WebRTC标准的Web API,抽象地对数字信号过程进行处理。
a. RTP Stack协议栈
Real Time Protocol
b. STUN/ICE
可以通过STUN和ICE组件来建立不同类型网络间的呼叫连接。
c. Session Management
一个抽象的会话层,提供会话建立和管理功能。该层协议留给应用开发者自定义实现。
音频引擎是包含一系列音频多媒体处理的框架,包括从视频采集卡到网络传输端等整个解决方案。
PS:VoiceEngine是WebRTC极具价值的技术之一,是Google收购GIPS公司后开源的。在VoIP上,技术业界领先,后面的文章会详细了解
采样频率:16khz,24khz,32khz;(默认为16khz)
自适应速率为10kbit/s ~ 52kbit/;
自适应包大小:30~60ms;
算法延时:frame + 3ms
Internet Low Bitrate Codec
VoIP音频流的窄带语音编解码器
采样频率:8khz;
20ms帧比特率为15.2kbps
30ms帧比特率为13.33kbps
标准由IETF RFC3951和RFC3952定义
c. NetEQ for Voice
回声消除器是一个基于软件的信号处理元件,能实时的去除mic采集到的回声。
噪声抑制也是一个基于软件的信号处理元件,用于消除与相关VoIP的某些类型的背景噪声(嘶嘶声,风扇噪音等等… …)
WebRTC视频处理引擎
VideoEngine是包含一系列视频处理的整体框架,从摄像头采集视频到视频信息网络传输再到视频显示整个完整过程的解决方案。
视频图像编解码器,是WebRTC视频引擎的默认的编解码器
VP8适合实时通信应用场景,因为它主要是针对低延时而设计的编解码器。
PS:VPx编解码器是Google收购ON2公司后开源的,VPx现在是WebM项目的一部分,而WebM项目是Google致力于推动的HTML5标准之一
视频抖动缓冲器,可以降低由于视频抖动和视频信息包丢失带来的不良影响。
图像质量增强模块
对网络摄像头采集到的图像进行处理,包括明暗度检测、颜色增强、降噪处理等功能,用来提升视频质量。
4、WebRTC核心模块API
(1)、网络传输模块:libjingle
(2)、音频、视频图像处理的主要数据结构
类、结构体、枚举常量 |
头文件 |
说明 |
Structures |
common_types.h |
Lists the structures common to the VoiceEngine & VideoEngine |
Enumerators |
common_types.h |
List the enumerators common to the VoiceEngine & VideoEngine |
Classes |
common_types.h |
List the classes common to VoiceEngine & VideoEngine |
class VoiceEngine |
voe_base.h |
How to allocate and release resources for the VoiceEngine using factory methods in the VoiceEngine class. It also lists the APIs which are required to enable file tracing and/or traces as callback messages |
class VideoEngine |
vie_base.h |
How to allocate and release resources for the VideoEngine using factory methods in the VideoEngine class. It also lists the APIs which are required to enable file tracing and/or traces as callback messages |
(3)、音频引擎(VoiceEngine)模块 APIs
sub-API |
头文件 |
说明 |
VoEAudioProcessing |
voe_audio_processing.h |
Adds support for Noise Suppression (NS), Automatic Gain Control (AGC) and Echo Control (EC). Receiving side VAD is also included. |
VoEBase |
voe_base.h |
Enables full duplex VoIP using G.711. |
VoECallReport |
voe_call_report.h |
Adds support for call reports which contains number of dead-or-alive detections, RTT measurements, and Echo metrics. |
VoECodec |
voe_codec.h |
Adds non-default codecs (e.g. iLBC, iSAC, G.722 etc.), Voice Activity Detection (VAD) support. |
VoEDTMF |
voe_dtmf.h |
Adds telephone event transmission, DTMF tone generation and telephone event detection. (Telephone events include DTMF.) |
VoEEncryption |
voe_encryption.h |
Adds external encryption/decryption support. |
VoEErrors |
voe_errors.h |
Error Codes for the VoiceEngine |
VoEExternalMedia |
voe_external_media.h |
Adds support for external media processing and enables utilization of an external audio resource. |
VoEFile |
voe_file.h |
Adds file playback, file recording and file conversion functions. |
VoEHardware |
voe_hardware.h |
Adds sound device handling, CPU load monitoring and device information functions. |
VoENetEqStats |
voe_neteq_stats.h |
Adds buffer statistics functions. |
VoENetwork |
voe_network.h |
Adds external transport, port and address filtering, Windows QoS support and packet timeout notifications. |
VoERTP_RTCP |
voe_rtp_rtcp.h |
Adds support for RTCP sender reports, SSRC handling, RTP/RTCP statistics, Forward Error Correction (FEC), RTCP APP, RTP capturing and RTP keepalive. |
VoEVideoSync |
voe_video_sync.h |
Adds RTP header modification support, playout-delay tuning and monitoring. |
VoEVolumeControl |
voe_volume_control.h |
Adds speaker volume controls, microphone volume controls, mute support, and additional stereo scaling methods. |
(4)、视频引擎(VideoEngine)模块 APIs
sub-API |
头文件 |
说明 |
ViEBase |
vie_base.h |
Basic functionality for creating a VideoEngine instance, channels and VoiceEngine interaction. NOTE: This API must always be created. |
ViECapture |
vie_capture.h |
Adds support for capture device allocation as well as capture device capabilities. |
ViECodec |
vie_codec.h |
Adds non-default codecs, codec settings and packet loss functionality. |
ViEEncryption |
vie_encryption.h |
Adds external encryption/decryption support. |
ViEErrors |
vie_errors.h |
Error codes for the VideoEngine |
ViEExternalCodec |
vie_external_codec.h |
Adds support for using external codecs. |
ViEFile |
vie_file.h |
Adds support for file recording, file playout, background images and snapshot. |
ViEImageProcess |
vie_image_process.h |
Adds effect filters, deflickering, denoising and color enhancement. |
ViENetwork |
vie_network.h |
Adds send and receive functionality, external transport, port and address filtering, Windows QoS support, packet timeout notification and changes to network settings. |
ViERender |
vie_render.h |
Adds rendering functionality. |
ViERTP_RTCP |
vie_rtp_rtcp.h |
Adds support for RTCP reports, SSRS handling RTP/RTCP statistics, NACK/FEC, keep-alive functionality and key frame request methods. |