webrtc要点记录

2019-08-20  本文已影响0人  hijiang

1、对于一些warning被认为是错误,修改src/BUILD.gn文件
修改
我们需要修改编译参数cflags,cflags的一些修改方式参考这个文件,我们在它修改完成后,追加自己的选项:
如:

defines += [
    "WEBRTC_POSIX",
    "_GLIBCXX_USE_CXX11_ABI=0",
  ]
cflags += [
    "-Wno-error=return-type",
    "-Wno-error=class-memaccess",
  ]

截图如下:


image.png

我的修改

cflags += [
    "-Wno-error=return-type",
    "-Wno-error=class-memaccess",
    "-Wno-error=implicit-fallthrough=",
    "-Wno-error=overloaded-virtual",
    "-Wno-error=int-in-bool-context",
    "-Wno-error=ignored-qualifiers",
  ]

2、chrome执行webrtc时,需要添加参数,否则无法使用:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=http://ip:3001 --user-data-dir=g:/temp2

3、关于使用自己的ssl库
在webrtc中默认使用boringssl,不知道这个库有什么问题,这个库的名字和openssl的一样,经常导致命名空间冲突或者其他一些鬼问题,于是想去掉下,流程如下:
添加参数:

rtc_build_ssl = false
rtc_ssl_root = "/..../openssl-OpenSSL_1_0_2g"

修改文件:

openssl_stream_adapter.cc
void OpenSSLStreamAdapter::EnableTimeCallbackForTesting() {
#ifdef OPENSSL_IS_BORINGSSL //这个宏原来没有,导致编译报错
  g_use_time_callback_for_testing = true;
#endif
}

4、服务端混合
需要安装libpulse.so.0,另外需要安装pulseaudio

apt-get install libpulse0
apt-get install pulseaudio 
//启动pulseaudio
pulseaudio --system --daemonize --high-priority --log-target=syslog --disallow-exit --disallow-module-loading=1
//root加入用户组,如果是其他用户,就加其他用户
sudo -s usermod -aG pulse,pulse-access root
//到这里就可以了
# pulseaudio --dump-conf
关闭空闲自动退出
# vim /etc/pulse/daemon.conf

设置 exit-idle-time= - 1     // exit-idle-time= Terminate the daemon after the last client quit and this time in seconds passed. Use a negative value to disable this feature. Defaults to 20. The --exit-idle-time command line option takes precedence.
上一篇 下一篇

猜你喜欢

热点阅读