You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
8.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. # WebRTC development
  2. The currently supported platforms are Windows, Mac OS X, Linux, Android and
  3. iOS. See the [Android][webrtc-android-development] and [iOS][webrtc-ios-development]
  4. pages for build instructions and example applications specific to these mobile platforms.
  5. ## Before You Start
  6. First, be sure to install the [prerequisite software][webrtc-prerequisite-sw].
  7. [webrtc-prerequisite-sw]: https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/development/prerequisite-sw/index.md
  8. ## Getting the Code
  9. For desktop development:
  10. 1. Create a working directory, enter it, and run `fetch webrtc`:
  11. ```
  12. $ mkdir webrtc-checkout
  13. $ cd webrtc-checkout
  14. $ fetch --nohooks webrtc
  15. $ gclient sync
  16. ```
  17. NOTICE: During your first sync, you'll have to accept the license agreement of the Google Play Services SDK.
  18. The checkout size is large due the use of the Chromium build toolchain and many dependencies. Estimated size:
  19. * Linux: 6.4 GB.
  20. * Linux (with Android): 16 GB (of which ~8 GB is Android SDK+NDK images).
  21. * Mac (with iOS support): 5.6GB
  22. 2. Optionally you can specify how new branches should be tracked:
  23. ```
  24. $ git config branch.autosetupmerge always
  25. $ git config branch.autosetuprebase always
  26. ```
  27. 3. Alternatively, you can create new local branches like this (recommended):
  28. ```
  29. $ cd src
  30. $ git checkout master
  31. $ git new-branch your-branch-name
  32. ```
  33. See the [Android][webrtc-android-development] and [iOS][webrtc-ios-development] pages for separate instructions.
  34. **NOTICE:** if you get `Remote: Daily bandwidth rate limit exceeded for <ip>`,
  35. make sure [you're logged in][webrtc-first-patch]. The quota is much larger for logged in users.
  36. ## Updating the Code
  37. Update your current branch with:
  38. ```
  39. $ git checkout master
  40. $ git pull origin master
  41. $ gclient sync
  42. $ git checkout my-branch
  43. $ git merge master
  44. ```
  45. ## Building
  46. [Ninja][ninja] is the default build system for all platforms.
  47. See the [Android][webrtc-android-development] and [iOS][webrtc-ios-development] pages for build
  48. instructions specific to those platforms.
  49. ## Generating Ninja project files
  50. [Ninja][ninja] project files are generated using [GN][gn]. They're put in a
  51. directory of your choice, like `out/Debug` or `out/Release`, but you can
  52. use any directory for keeping multiple configurations handy.
  53. To generate project files using the defaults (Debug build), run (standing in
  54. the src/ directory of your checkout):
  55. ```
  56. $ gn gen out/Default
  57. ```
  58. To generate ninja project files for a Release build instead:
  59. ```
  60. $ gn gen out/Default --args='is_debug=false'
  61. ```
  62. To clean all build artifacts in a directory but leave the current GN
  63. configuration untouched (stored in the args.gn file), do:
  64. ```
  65. $ gn clean out/Default
  66. ```
  67. See the [GN][gn-doc] documentation for all available options. There are also more
  68. platform specific tips on the [Android][webrtc-android-development] and
  69. [iOS][webrtc-ios-development] instructions.
  70. ## Compiling
  71. When you have Ninja project files generated (see previous section), compile
  72. (standing in `src/`) using:
  73. For [Ninja][ninja] project files generated in `out/Default`:
  74. ```
  75. $ ninja -C out/Default
  76. ```
  77. ## Using Another Build System
  78. Other build systems are **not supported** (and may fail), such as Visual
  79. Studio on Windows or Xcode on OSX. GN supports a hybrid approach of using
  80. [Ninja][ninja] for building, but Visual Studio/Xcode for editing and driving
  81. compilation.
  82. To generate IDE project files, pass the `--ide` flag to the [GN][gn] command.
  83. See the [GN reference][gn-doc] for more details on the supported IDEs.
  84. ## Working with Release Branches
  85. To see available release branches, run:
  86. ```
  87. $ git branch -r
  88. ```
  89. To create a local branch tracking a remote release branch (in this example,
  90. the 43 branch):
  91. ```
  92. $ git checkout -b my_branch refs/remotes/branch-heads/43
  93. $ gclient sync
  94. ```
  95. **NOTICE**: depot_tools are not tracked with your checkout, so it's possible gclient
  96. sync will break on sufficiently old branches. In that case, you can try using
  97. an older depot_tools:
  98. ```
  99. which gclient
  100. $ # cd to depot_tools dir
  101. $ # edit update_depot_tools; add an exit command at the top of the file
  102. $ git log # find a hash close to the date when the branch happened
  103. $ git checkout <hash>
  104. $ cd ~/dev/webrtc/src
  105. $ gclient sync
  106. $ # When done, go back to depot_tools, git reset --hard, run gclient again and
  107. $ # verify the current branch becomes REMOTE:origin/master
  108. ```
  109. The above is untested and unsupported, but it might help.
  110. Commit log for the branch: [https://webrtc.googlesource.com/src/+log/branch-heads/43][m43-log]
  111. To browse it: [https://webrtc.googlesource.com/src/+/branch-heads/43][m43]
  112. For more details, read Chromium's [Working with Branches][chromium-work-branches] and
  113. [Working with Release Branches][chromium-work-release-branches] pages.
  114. ## Contributing Patches
  115. Please see [Contributing Fixes][webrtc-contributing] for information on how to run
  116. `git cl upload`, getting your patch reviewed, and getting it submitted.
  117. This also includes information on how to run tryjobs, if you're a committer.
  118. ## Chromium Committers
  119. Many WebRTC committers are also Chromium committers. To make sure to use the
  120. right account for pushing commits to WebRTC, use the `user.email` Git config
  121. setting. The recommended way is to have the chromium.org account set globally
  122. as described at the [depot tools setup page][depot-tools] and then set `user.email`
  123. locally for the WebRTC repos using (change to your webrtc.org address):
  124. ```
  125. $ cd /path/to/webrtc/src
  126. $ git config user.email yourname@webrtc.org
  127. ```
  128. ## Example Applications
  129. WebRTC contains several example applications, which can be found under
  130. `src/webrtc/examples`. Higher level applications are listed first.
  131. ### Peerconnection
  132. Peerconnection consist of two applications using the WebRTC Native APIs:
  133. * A server application, with target name `peerconnection_server`
  134. * A client application, with target name `peerconnection_client` (not currently supported on Mac/Android)
  135. The client application has simple voice and video capabilities. The server
  136. enables client applications to initiate a call between clients by managing
  137. signaling messages generated by the clients.
  138. #### Setting up P2P calls between peerconnection_clients
  139. Start `peerconnection_server`. You should see the following message indicating
  140. that it is running:
  141. ```
  142. Server listening on port 8888
  143. ```
  144. Start any number of `peerconnection_clients` and connect them to the server.
  145. The client UI consists of a few parts:
  146. **Connecting to a server:** When the application is started you must specify
  147. which machine (by IP address) the server application is running on. Once that
  148. is done you can press **Connect** or the return button.
  149. **Select a peer:** Once successfully connected to a server, you can connect to
  150. a peer by double-clicking or select+press return on a peer's name.
  151. **Video chat:** When a peer has been successfully connected to, a video chat
  152. will be displayed in full window.
  153. **Ending chat session:** Press **Esc**. You will now be back to selecting a
  154. peer.
  155. **Ending connection:** Press **Esc** and you will now be able to select which
  156. server to connect to.
  157. #### Testing peerconnection_server
  158. Start an instance of `peerconnection_server` application.
  159. Open `src/webrtc/examples/peerconnection/server/server_test.html` in your
  160. browser. Click **Connect**. Observe that the `peerconnection_server` announces
  161. your connection. Open one more tab using the same page. Connect it too (with a
  162. different name). It is now possible to exchange messages between the connected
  163. peers.
  164. ### Relay Server
  165. Target name `relayserver`. Relays traffic when a direct peer-to-peer
  166. connection can't be established. Can be used with the call application above.
  167. ### STUN Server
  168. Target name `stunserver`. Implements the STUN protocol for Session Traversal
  169. Utilities for NAT as documented in [RFC 5389][rfc-5389].
  170. ### TURN Server
  171. Target name `turnserver`. In active development to reach compatibility with
  172. [RFC 5766][rfc-5766].
  173. [ninja]: https://ninja-build.org/
  174. [gn]: https://gn.googlesource.com/gn/+/master/README.md
  175. [gn-doc]: https://gn.googlesource.com/gn/+/master/docs/reference.md#IDE-options
  176. [webtc-android-development]: https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/android/index.md
  177. [webrtc-ios-development]: https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/ios/index.md
  178. [chromium-work-branches]: https://www.chromium.org/developers/how-tos/get-the-code/working-with-branches
  179. [chromium-work-release-branches]: https://www.chromium.org/developers/how-tos/get-the-code/working-with-release-branches
  180. [webrtc-contributing]: https://webrtc.org/contributing/
  181. [depot-tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
  182. [rfc-5389]: https://tools.ietf.org/html/rfc5389
  183. [rfc-5766]: https://tools.ietf.org/html/rfc5766
  184. [webrtc-first-patch]: https://webrtc.org/native-code/development/#contributing-your-first-patch
  185. [m43-log]: https://webrtc.googlesource.com/src/+log/branch-heads/43
  186. [m43]: https://webrtc.googlesource.com/src/+/branch-heads/43