webrtc 针对 windows 平台的编译和运行

1 环境准备

官方说明:

http://www.webrtc.org/reference/getting-started/prerequisite-sw

1.1 安装 SVN

安装 TortoiseSVN

http://tortoisesvn.net/downloads.html

1.2 安装 git

1.3 安装 Depot Tools

官方说明:

如果这个地址打不开,那直接 svn 下载

使用 TortoiseSVN checkout http://src.chromium.org/svn/trunk/tools/depot_tools 到 depot_tools 目录

然后将 depot_tools 目录添加到 PATH 环境变量中

2 获取源码

新建一个目录,比如 webrtc,控制台 cd 到该目录

获取源码,在控制台依次执行下面的命令:

gclient config http://webrtc.googlecode.com/svn/trunk
gclient sync --force

获取平台相关文件,生成本地工程,在windows平台会生成VC工程文件

gclient runhooks --force

如果执行过程中出现连不上 commondatastorage.googleapis.com (连接被重置)的错误,修改 trunk/webrtc/tools/update_resources.py,将 http 改为 https

-REMOTE_URL_BASE = 'http://commondatastorage.googleapis.com/webrtc-resources'
+REMOTE_URL_BASE = 'https://commondatastorage.googleapis.com/webrtc-resources'

3 构建工程

打开 trunk 目录下的 all.sln ,编译名称为 All 的项目,会编译所有的项目。

我在编译时,出现了几个错误,下面几个项目编译不通过,这里把解决方法记录下来。

3.1 libjingle_media

LINK : fatal error LNK1181: cannot open input file 'd3d9.lib;gdi32.lib;strmiids.lib;winmm.lib'

刚开始以为这些库没有,但是在 WindowSDK 的 lib 目录下有这些问题,后来才发现,VS 中多个库是用空格分开的,这里用分号分开了,所有出现错误。Release、Debug 配置都有这个问题

3.2 voe_ui_win_test

1>WinTest.cc
1>WinTestDlg.cc
1>e:\webrtc\trunk\webrtc/voice_engine/test/win_test/WinTest.h(14) : fatal error C1189: #error :  "include 'stdafx.h' before including this file for PCH"
1>e:\webrtc\trunk\webrtc/voice_engine/test/win_test/WinTest.h(14) : fatal error C1189: #error :  "include 'stdafx.h' before including this file for PCH"

调整包含头文件顺序,会出现更多的错误,后来干脆移除该项目,反正只是一个测试程序。

3.3 modules_unittests

1>audio_vector_unittest.cc
1>.\audio_coding\neteq4\audio_vector_unittest.cc(83) : error C2355: 'this' : can only be referenced inside non-static member functions
1>.\audio_coding\neteq4\audio_vector_unittest.cc(83) : error C2227: left of '->array_length' must point to class/struct/union/generic type
....

出现错误的地方都是 this->array_ 和 this->array_length() ,把 this-> 去掉应该可以编译。

3.4 desktop_capture

1>desktop_region.cc
1>D:\Program Files\Microsoft Visual Studio 9.0\VC\include\xutility(337) : error C2664: 'bool (const webrtc::DesktopRegion::RowSpan &,int32_t)' : cannot convert parameter 2 from 'webrtc::DesktopRegion::RowSpan' to 'int32_t'
1>D:\Program Files\Microsoft Visual Studio 9.0\VC\include\xutility(315) : error C2664: 'bool (const webrtc::DesktopRegion::RowSpan &,int32_t)' : cannot convert parameter 2 from 'const webrtc::DesktopRegion::RowSpan' to 'int32_t'
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

这个错误只有 Debug 配置会出现,是因为在 Debug 配置下,标准库对大小比较算子多做了反向校验,通过在该文件最开始加上下面一行代码可以屏蔽该校验

#define _HAS_ITERATOR_DEBUGGING 0

4 运行测试

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fighting Horse

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值