logo资料库

webrtc教程(v0.3).docx

第1页 / 共117页
第2页 / 共117页
第3页 / 共117页
第4页 / 共117页
第5页 / 共117页
第6页 / 共117页
第7页 / 共117页
第8页 / 共117页
资料共117页,剩余部分请下载后查看
1工具:
1.1depot_tools:
1.1.1目标:
1.1.2chromium使用它来
1.1.3使用说明在这儿
1.1.4下载:
1.1.4.1linux下:
1.1.4.2window下:
1.1.5使用:
1.1.5.1用gclient 获取代码
1.1.5.2gclient 命令:
1.1.6具体使用例子:
1.1.6.1安装工具
1.1.6.2.配置
1.2Gyp工具
1.3Python工具
1.4本地集成开发环境(IDE)
1.4.1Visual studio
1.4.2Kdevelop
1.4.3Eclipse
2Webrtc
2.1下载、编译:
2.1.1Windows下:
2.1.2ubuntu下编译:
2.1.3编译Android(只能在linux下):
3webrtc开发:
3.1开发P2P视频软件需要处理的问题
3.1.1用户列的获取、交换、信令的交换
3.1.2P2P通信
3.1.3多媒体处理
3.1.3.1音视频捕获、播放
3.1.3.2音视频编解码
3.1.3.3音视频效果优化
3.2webrtc架构:
3.2.1WebRTC架构组件介绍
(1)你的web应用程序
(2)Web API
(3)WebRTC Native C++ API
(4)Transport / Session
(5)VoiceEngine
(6)VideoEngine
3.2.2WebRTC核心模块API介绍
(1)网络传输模块:libjingle
(2)WebRTC Native C++ API
(3)音频、视频图像处理的主要数据结构
(4)音频引擎(VoiceEngine)模块 APIs
(5)视频引擎(VideoEngine)模块 APIs
3.2.3webRTC核心API详解
3.2.3.1libjingle_peerconnection
3.2.3.2libjingle_media库:
3.2.3.2.1视频采集,处理、渲染类:
4Libjingle详细介绍
4.1重要组件:
4.1.1信号:
4.1.2线程和消息
4.1.3名称转换
4.1.4Ssl支持
4.1.5连接
4.1.6传输,通道,连接
4.1.7候选项
4.1.8数据包
4.2如何工作:
4.2.1Application模块
4.2.2XMPP Messaging Component.模块
4.2.3Session Logic and management commponent模块。
4.2.4Peer to peer Component模块。
4.2.5其他
4.3建立libjingle应用程序
5代码分析:
5.1音频通道建立过程:
5.2音频接收播放过程:
5.3视频接收播放过程:
6协议:
6.1
6.1.1原理介绍
6.1.2XMPP协议网络架构
6.1.3XMPP协议的组成
6.1.4Xmpp介绍
6.1.5协议内容
6.2Stun协议:
6.2.1P2P实现的原理
6.2.2P2P的常用实现
6.2.3Stun uri
6.2.4内容
6.2.5中文内容
6.2.6开源服务器
6.2.7公开的免费STUN服务器
6.3Turn协议
6.3.1概念
6.3.2Turn uri
6.3.3开源服务器工程
6.3.4开源库
6.4交互式连接建立(Interactive Connectivity Establishment),一种
6.4.1IETF 规格
6.4.2开源工程:
6.5XEP-0166 Jingle
6.5.1绪论
6.5.2需求
6.6Sctp协议
6.7Rtp协议
7附件:
7.1Gyp工具
7.2Google test程序
7.3Webrtc库介绍
7.4
7.5STUN和TURN技术浅析
7.6基于ICE的VoIP穿越NAT改进方案
7.7ubuntu安装使用stuntman  
7.8一个开源的ICE库——libnice介绍
7.94种利用TURN穿越对称型NAT方案的设计与实现
7.10基于ICE方式SIP信令穿透Symmetric_NAT技术研究
Webrtc 教程 版本 0.3(2014 年 2 月) 康林 (16614119@qq.com) 本文博客地址:http://blog.csdn.net/kl222/article/details/17198873 版本 V0.1 初建文档 V0.2 增加协议文档 V0.3 细化了 windows 下编译过程。 内容 增加 IDE 工具用法。 重新排版整个文档。 时间 2013 年 11 月 2014 年 2 月 8 日 2014 年 2 月 20 日 作者 康林 康林 康林
1.1 2 3 1.1.4.1 1.1.4.2 1 工具:.......................................................................................................................................... 4 depot_tools:................................................................................................................ 4 1.1.1 目标:..................................................................................................................... 4 1.1.2 chromium·使用它来............................................................................................. 4 1.1.3 使用说明在这儿..................................................................................................... 4 1.1.4 下载:..................................................................................................................... 4 linux 下:................................................................................................ 4 window 下:.............................................................................................. 5 1.1.5 使用:..................................................................................................................... 5 1.1.5.1 用 gclient 获取代码.............................................................................. 5 gclient 命令:....................................................................................... 5 1.1.5.2 1.1.6 具体使用例子:....................................................................................................... 5 1.1.6.1 安装工具................................................................................................... 5 1.1.6.2 .配置.......................................................................................................... 6 Gyp 工具 ......................................................................................................................... 6 1.2 Python 工具................................................................................................................... 6 1.3 1.4 本地集成开发环境(IDE).......................................................................................... 6 1.4.1 Visual studio.............................................................................................................6 1.4.2 Kdevelop ................................................................................................................12 1.4.3 Eclipse....................................................................................................................13 Webrtc........................................................................................................................................ 13 2.1 下载、编译:.............................................................................................................. 13 2.1.1 Windows 下:........................................................................................................ 13 2.1.2 ubuntu 下编译:.................................................................................................. 17 2.1.3 编译 Android(只能在 linux 下):...................................................................... 20 webrtc 开发:........................................................................................................................... 20 3.1 开发 P2P 视频软件需要处理的问题.......................................................................... 20 3.1.1 用户列的获取、交换、信令的交换................................................................... 20 3.1.2 P2P 通信................................................................................................................ 20 3.1.3 多媒体处理........................................................................................................... 21 3.1.3.1 音视频捕获、播放................................................................................. 21 3.1.3.2 音视频编解码......................................................................................... 21 3.1.3.3 音视频效果优化..................................................................................... 21 webrtc 架构:............................................................................................................. 21 3.2.1 WebRTC 架构组件介绍.......................................................................................... 21 (1) 你的 web 应用程序........................................................................................ 21 Web API.......................................................................................................... 21 (2) WebRTC Native C++ API.............................................................................. 21 (3) Transport / Session.................................................................................. 21 (4) VoiceEngine.................................................................................................. 22 (5) VideoEngine.................................................................................................. 23 (6) 3.2.2 WebRTC 核心模块 API 介绍.................................................................................. 23 (1) 网络传输模块:libjingle.............................................................................. 23 (2) WebRTC Native C++ API............................................................................ 23 (3) 音频、视频图像处理的主要数据结构........................................................ 25 (4) 音频引擎(VoiceEngine)模块 APIs..........................................................26 3.2
4 4.2 3.2.3.1 3.2.3.2 (5) 视频引擎(VideoEngine)模块 APIs......................................................... 27 3.2.3 webRTC 核心 API 详解.......................................................................................... 28 libjingle_peerconnection................................................................. 28 libjingle_media 库:.......................................................................... 32 3.2.3.2.1 视频采集,处理、渲染类: ........................................................................... 32 Libjingle 详细介绍................................................................................................................. 36 4.1 重要组件:.................................................................................................................. 36 4.1.1 信号:................................................................................................................... 36 4.1.2 线程和消息........................................................................................................... 36 4.1.3 名称转换............................................................................................................... 36 4.1.4 Ssl 支持..................................................................................................................36 4.1.5 连接....................................................................................................................... 36 4.1.6 传输,通道,连接............................................................................................... 37 4.1.7 候选项................................................................................................................... 37 4.1.8 数据包................................................................................................................... 37 如何工作:.................................................................................................................. 37 4.2.1 Application 模块....................................................................................................38 4.2.2 XMPP Messaging Component.模块......................................................................38 4.2.3 Session Logic and management commponent 模块。..........................................39 4.2.4 Peer to peer Component 模块。............................................................................39 4.2.5 其他....................................................................................................................... 40 4.3 建立 libjingle 应用程序.......................................................................................... 40 5 代码分析:................................................................................................................................ 40 5.1 音频通道建立过程:.................................................................................................. 40 5.2 音频接收播放过程:.................................................................................................. 41 5.3 视频接收播放过程:.................................................................................................. 44 6 协议:.......................................................................................................................................... 46 XMPP 协议:................................................................................................................... 46 6.1.1 原理介绍............................................................................................................... 46 6.1.2 XMPP 协议网络架构............................................................................................47 6.1.3 XMPP 协议的组成.................................................................................................. 49 6.1.4 Xmpp 介绍.............................................................................................................. 50 6.1.5 协议内容............................................................................................................... 50 Stun 协议:................................................................................................................... 53 6.2.1 P2P 实现的原理.................................................................................................... 54 6.2.2 P2P 的常用实现.................................................................................................... 56 6.2.3 Stun uri............................................................................................................... 59 6.2.4 内容....................................................................................................................... 59 6.2.5 中文内容............................................................................................................... 60 6.2.6 开源服务器........................................................................................................... 62 6.2.7 公开的免费 STUN 服务器...................................................................................62 Turn 协议..................................................................................................................... 63 6.3.1 概念....................................................................................................................... 63 6.3.2 Turn uri.................................................................................................................. 64 6.3.3 开源服务器工程................................................................................................... 64 6.3.4 开源库................................................................................................................... 64 6.4 交互式连接建立(Interactive Connectivity Establishment),一种综合性的 6.1 6.2 6.3
6.5 6.6 6.7 NAT 穿越的技术。...................................................................................................................64 6.4.1 IETF 规格..............................................................................................................69 6.4.2 开源工程:........................................................................................................... 70 XEP-0166 Jingle........................................................................................................ 71 6.5.1 绪论....................................................................................................................... 72 6.5.2 需求....................................................................................................................... 73 Sctp 协议..................................................................................................................... 97 Rtp 协议 ....................................................................................................................... 99 7 附件:...................................................................................................................................... 101 Gyp 工具 ..................................................................................................................... 101 7.1 Google test 程序 ..................................................................................................... 103 7.2 Webrtc 库介绍........................................................................................................... 104 7.3 webrtc 代码相关基础知识....................................................................................... 105 7.4 STUN 和 TURN 技术浅析............................................................................................. 107 7.5 7.6 基于 ICE 的 VoIP 穿越 NAT 改进方案...................................................................... 108 ubuntu 安装使用 stuntman...................................................................................... 113 7.7 7.8 一个开源的 ICE 库——libnice 介绍..................................................................... 113 4 种利用 TURN 穿越对称型 NAT 方案的设计与实现............................................... 115 7.9 7.10 基于 ICE 方式 SIP 信令穿透 Symmetric_NAT 技术研究........................................ 116 1 工具: 1.1 depot_tools: chromium 自己整了一套开发工具系统,原来叫 gclient(名字好像让位给 google 桌面客户端了) ,现 在改名 depot_tools。 1.1.1 目标: Wrapper script for checking out and updating source code from multiple SCM repository locations. chromium 使用了(目前 @159834)107 个代码仓库的代码,这些分散在多个代码仓库,chromiun 不需要 某些仓库的东西,google 就封装个工具,这个工具既支持 svn,也支持 git,不光能 down 代码,也支持 了 patch cpplint,pylint    apply_issue  junction  codereview 1.1.2 chromium 使用它来  更新 chromium 代码  生成工程文件,windows 上生产 sln,mac 生产 xcode 工程,linux 生成 scons 或者 makefile  其他的 patch,codereview,管理分散开发人员的修改 1.1.3 使用说明在这儿 http://www.chromium.org/developers/how-tos/depottools 1.1.4 下载: 1.1.4.1 linux 下: sudo apt-get install git git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
1.1.4.2 window 下:  已装 cygwin: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git  无 cygwin: https://src.chromium.org/svn/trunk/tools/depot_tools.zip 1.1.5 使用: 1.1.5.1 用 gclient 获取代码  首先会更新 depot_tools,有两种 bat 和 sh,目的都一样 更新 depot_tools,然后运行 python 版 gclient.py,参数都传给 gclient.py 这里解决了鸡生蛋还是蛋生鸡的问题,更新了 gclient.py  生成.gclient 文件,gclient 指定了某个版本的 chromium·代码  执行 gclient sync,更新代码,生成工程文件,这里使用了另一个工具 GYP 1.1.5.2 gclient 命令: Commands are: cleanup config diff fetch help hookinfo pack recurse revert revinfo runhooks status sync update Cleans up all working copies. Create a .gclient file in the current directory. Displays local diff for every dependencies. Fetches upstream commits for all modules. Prints list of commands or help for a specific command. Output the hooks that would be run by `gclient runhooks` Generate a patch which can be applied at the root of the tree. Operates on all the entries. Revert all modifications in every dependencies. Output revision info mapping for the client and its dependencies. Runs hooks for files that have been modified in the local working copy. Show modification status for every dependencies. Checkout/update all modules. Alias for the sync command. Deprecated. Prints list of commands or help for a specific command. Options: --version -h, --help -j JOBS, --jobs=JOBS show program's version number and exit show this help message and exit Specify how many SCM commands can run in parallel; default=8 -v, --verbose Produces additional output for diagnostics. Can be used up to three times for more logging info. --gclientfile=CONFIG_FILENAME --spec=SPEC create a gclient file containing the provided string. Specify an alternate .gclient file Due to Cygwin/Python brokenness, it probably can't contain any newlines. 1.1.6 具体使用例子: 1.1.6.1 安装工具 http://www.chromium.org/developers/how-tos/install-depot-tools
1.1.6.2 .配置 主要是写 .gclient 和 DEPS python 语法(精确点就是 json 语法+“#”型注释,list 最末元素可以有,执行时使用 python 的 eval 来解释的) .gclient 1.2 Gyp 工具 Gyp 工具简介见附件。Google 自己搞的玩意。Webrtc 不是直接用的 gyp,而是又封装了一下。 Webrtc 中的 gyp 工具是 build/ gyp_chromium 1.3 Python 工具 整个 webrtc 工程是由 python 程序进行维护。而整个 webrtc 工程现在处理一个完全不稳定的阶段。所以需 要了解一些基本的 python 语法知识。 1.4 本地集成开发环境(IDE) 工欲善其事,必先利其器。所以下面介绍下本地集成开发环境。 1.4.1 Visual studio 一般的在 windows 本地开发环境(IDE)是 visual studio。然而 webrtc 默认的是 ninja。 虽然可以手工生成 vs 工程,但是经常出现兼容性问题。所以下面介绍下 vs 加 ninja 开发环境。 Webrtc 默认生成的工程位于源码根目录下的 out 目录中。 打开 vs2012:
分享到:
收藏