簡介
起因:將實時通信功能引入到瀏覽器中的技術(shù)
三種運行模式:P2P(Peer to Peer)、SFU(Selective Forwarding Unit)、MCU(Multi-point Control Unit)。P2P盡量在客戶端之間建立媒體數(shù)據(jù)連接,避免使用服務(wù)器轉(zhuǎn)發(fā)媒體數(shù)據(jù),SFU和MCU模式一定會由服務(wù)器轉(zhuǎn)發(fā)媒體數(shù)據(jù)。
WebRTC服務(wù)端:3種模式下的信令邏輯以及SFU和MCU模式下的媒體處理邏輯有非常多的開源或商用實現(xiàn),如AppRTC、Janus、Kurento、Licode、mediasoup、Medooze和OWT
P2P網(wǎng)狀結(jié)構(gòu):參與通話的每個用戶都和其他所有用戶一一建立P2P連接,進(jìn)行音視頻數(shù)據(jù)的發(fā)送和接收
SFU結(jié)構(gòu):參與通話的每個用戶都把音視頻數(shù)據(jù)發(fā)送給媒體服務(wù)器,并從媒體服務(wù)器接收其他所有用戶的音視頻數(shù)據(jù),這些接收的音視頻數(shù)據(jù)是各自獨立的
MCU結(jié)構(gòu):參與通話的每個用戶都把音視頻數(shù)據(jù)發(fā)送給媒體服務(wù)器,媒體服務(wù)器把所有用戶發(fā)送的音視頻數(shù)據(jù)合成一體后,下發(fā)給每個用戶,這樣每個用戶只需要從媒體服務(wù)器接收一路音視頻數(shù)據(jù)
Window編譯環(huán)境
1、主要步驟可參考https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
2、需要翻墻設(shè)置代理:
git代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
gclient代理,這里都是設(shè)置成http哦,https也會報錯
set https_proxy=http://localhost:1080
set http_proxy=http://localhost:1080
3、gclient sync出錯或者卡在了still working on提示的時候,可以使用gclient sync -j1 -v查看到底卡在哪里,然后單獨遷出來
4、如果遇到了python版本不對導(dǎo)致的問題,如
TypeError: cannot use a string pattern on a bytes-like object
那么去C:\Users\Administrator.vpython-root\030238\Scripts路徑下看一下是不是這里的pyhont是3的版本,貌似gclient會默認(rèn)拷貝一個python的版本過來,手動把里面的python替換成2的版本就可以
5、如果遇到了../../third_party/ffmpeg/libavcodec/pcm.c(623): error C2059: syntax error: 'string'問題,參考
https://github.com/open-webrtc-toolkit/owt-client-native/issues/329
6、如果是OWT的客戶端代碼,編譯腳本如下:
python build-win.py --arch x86 --scheme debug --gn_gen --sdk --ssl_root D:\lib\openssl1_1_1 --msdk_root "D:\Program Files (x86)\IntelSWTools\Intel(R) Media SDK 2019 R1\Software Development Kit" --output_path E:\ndrtc\ndrtc- client-sdk-windows-gerrit\ndrtc-client-sdk-windows\owt-sdk\win
Mac環(huán)境解決翻墻問題
在~/.bash_profile 文件中,添加如下代碼:
function proxy_off(){
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
echo -e "已關(guān)閉代理"
}
function proxy_on() {
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
export http_proxy="http://127.0.0.1:1087"#注意,根據(jù)自己的配置設(shè)置有可能會是1080或1086
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
echo -e "已開啟代理"
}
執(zhí)行source ~/.bash_profile,使其立刻生效。
需要使用代理時開啟ss全局模式,然后打開終端,輸入proxy_on就會啟動。如果需要關(guān)閉,只需要輸入proxy_off
判斷終端是否走了代理服務(wù)器的方法:curl cip.cc
該設(shè)置僅對當(dāng)前終端窗口生效,關(guān)閉窗口,下次需要在設(shè)置一次proxy_on