WebRTC(Web Real-Time Communication)項目的最終目的主要是讓Web開發者能夠基于浏覽器(Chrome\FireFox\...)輕易快捷開發出豐富的實時多媒體應用,而無需下載下傳安裝任何插件,Web開發者也無需關注多媒體的數字信号處理過程,隻需編寫簡單的Javascript程式即可實作,W3C等組織正在制定Javascript 标準API,目前是WebRTC 1.0版本,Draft狀态,網址;另外WebRTC還希望能夠建立一個多網際網路浏覽器間健壯的實時通信的平台,形成開發者與浏覽器廠商良好的生态環境。同時,Google也希望和緻力于讓WebRTC的技術成為HTML5标準之一,可見Google布局之深遠。
架構圖顔色辨別說明:
(1)紫色部分是Web開發者API層;
(2)藍色實線部分是面向浏覽器廠商的API層(也就是紅色框标内子產品,也是本人專注研究的部分)
(3)藍色虛線部分浏覽器廠商可以自定義實作
(1) Your Web App
Web開發者開發的程式,Web開發者可以基于內建WebRTC的浏覽器提供的web API開發基于視訊、音頻的實時通信應用。
(2) Web API
面向第三方開發者的WebRTC标準API(Javascript),使開發者能夠容易地開發出類似于網絡視訊聊天的web應用,最新的标準化程序可以檢視這裡 。
(3) WebRTC Native C++ API
本地C++ API層,使浏覽器廠商容易實作WebRTC标準的Web API,抽象地對數字信号過程進行處理。
(4) Transport / Session
傳輸/會話層
會話層元件采用了libjingle庫的部分元件實作,無須使用xmpp/jingle協定
a. RTP Stack協定棧
Real Time Protocol
b. STUN/ICE
可以通過STUN和ICE元件來建立不同類型網絡間的呼叫連接配接。
c. Session Management
一個抽象的會話層,提供會話建立和管理功能。該層協定留給應用開發者自定義實作。
(5) VoiceEngine
音頻引擎是包含一系列音頻多媒體處理的架構,包括從視訊采集卡到網絡傳輸端等整個解決方案。
PS:VoiceEngine是WebRTC極具價值的技術之一,是Google收購GIPS公司後開源的。在VoIP上,技術業界領先,後面的文章會詳細了解
a. iSAC
Internet Speech Audio Codec
針對VoIP和音頻流的寬帶和超寬帶音頻編解碼器,是WebRTC音頻引擎的預設的編解碼器
采樣頻率:16khz,24khz,32khz;(預設為16khz)
自适應速率為10kbit/s ~ 52kbit/;
自适應包大小:30~60ms;
算法延時:frame + 3ms
b. iLBC
Internet Low Bitrate Codec
VoIP音頻流的窄帶語音編解碼器
采樣頻率:8khz;
20ms幀比特率為15.2kbps
30ms幀比特率為13.33kbps
标準由IETF RFC3951和RFC3952定義
c. NetEQ for Voice
針對音頻軟體實作的語音信号處理元件
NetEQ算法:自适應抖動控制算法以及語音包丢失隐藏算法。使其能夠快速且高解析度地适應不斷變化的網絡環境,確定音質優美且緩沖延遲最小。
是GIPS公司獨步天下的技術,能夠有效的處理由于網絡抖動和語音包丢失時候對語音品質産生的影響。
PS:NetEQ 也是WebRTC中一個極具價值的技術,對于提高VoIP品質有明顯效果,加以AEC\NR\AGC等子產品內建使用,效果更好。
d. Acoustic Echo Canceler (AEC)
回聲消除器是一個基于軟體的信号處理元件,能實時的去除mic采集到的回聲。
e. Noise Reduction (NR)
噪聲抑制也是一個基于軟體的信号處理元件,用于消除與相關VoIP的某些類型的背景噪聲(嘶嘶聲,風扇噪音等等… …)
(6) VideoEngine
WebRTC視訊處理引擎
VideoEngine是包含一系列視訊處理的整體架構,從攝像頭采集視訊到視訊資訊網絡傳輸再到視訊顯示整個完整過程的解決方案。
a. VP8
視訊圖像編解碼器,是WebRTC視訊引擎的預設的編解碼器
VP8适合實時通信應用場景,因為它主要是針對低延時而設計的編解碼器。
PS:VPx編解碼器是Google收購ON2公司後開源的,VPx現在是WebM項目的一部分,而WebM項目是Google緻力于推動的HTML5标準之一
b. Video Jitter Buffer
視訊抖動緩沖器,可以降低由于視訊抖動和視訊資訊包丢失帶來的不良影響。
c. Image enhancements
圖像品質增強子產品
對網絡攝像頭采集到的圖像進行處理,包括明暗度檢測、顔色增強、降噪處理等功能,用來提升視訊品質。
WebRTC重用了libjingle的一些元件,主要是network和transport元件,關于libjingle的文檔資料可以檢視這裡。
常量\VideoEngine\VoiceEngine
注意:以下所有的方法、類、結構體、枚舉常量等都在webrtc命名空間裡
類、結構體、枚舉常量
頭檔案
說明
Structures
common_types.h
Lists the structures common to the VoiceEngine & VideoEngine
Enumerators
List the enumerators common to the VoiceEngine & VideoEngine
Classes
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
下表列的是目前在 VoiceEngine中可用的sub 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
Enables full duplex VoIP using G.711.
NOTE: This API must always be created.
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.
下表列的是目前在 VideoEngine中可用的sub APIs
ViEBase
Basic functionality for creating a VideoEngine instance, channels and VoiceEngine interaction.
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
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.