centricular / gstwebrtc-demos

Superseded by https://gitlab.freedesktop.org/gstreamer/gstreamer/-/tree/main/subprojects/gst-examples/webrtc - Demo apps for using gstreamer's webrtc implementation
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/tree/main/subprojects/gst-examples/webrtc
BSD 2-Clause "Simplified" License
490 stars 197 forks source link

Moved - June 2020

This repository has been moved and integrated with upstream's gst-examples repository available from https://gitlab.freedesktop.org/gstreamer/gst-examples/.

As a general warning, most of the the following README contents are now very much outdated with respect to upstream GStreamer. An updated README is available from https://gitlab.freedesktop.org/gstreamer/gst-examples/-/blob/master/webrtc/README.md.

GStreamer WebRTC demos

All demos use the same signalling server in the signalling/ directory

Downloading GStreamer

The GStreamer WebRTC implementation has now been merged upstream, and is in the GStreamer 1.14 release. Binaries can be found here:

https://gstreamer.freedesktop.org/download/

Building GStreamer from source

If you don't want to use the binaries provided by GStreamer or on your Linux distro, you can build GStreamer from source.

The easiest way to build the webrtc plugin and all the plugins it needs, is to use Cerbero. These instructions should work out of the box for all platforms, including cross-compiling for iOS and Android.

One thing to note is that it's written in Python 2, so you may need to replace all instances of ./cerbero-uninstalled (or cerbero) with python2 cerbero-uninstalled or whatever Python 2 is called on your platform.

Building GStreamer manually from source

Here are the commands for Ubuntu 18.04.

sudo apt-get install -y gstreamer1.0-tools gstreamer1.0-nice gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-plugins-good libgstreamer1.0-dev git libglib2.0-dev libgstreamer-plugins-bad1.0-dev libsoup2.4-dev libjson-glib-dev

For hacking on the webrtc plugin, you may want to build manually using the git repositories:

You can build these with either Autotools gst-uninstalled:

https://arunraghavan.net/2014/07/quick-start-guide-to-gst-uninstalled-1-x/

Or with Meson gst-build:

https://cgit.freedesktop.org/gstreamer/gst-build/

You may need to install the following packages using your package manager:

json-glib, libsoup, libnice, libnice-gstreamer1 (the gstreamer plugin for libnice, called gstreamer1.0-nice Debian)

Filing bugs

Please only file bugs about the demos here. Bugs about GStreamer's WebRTC implementation should be filed on the GStreamer bugzilla.

You can also find us on IRC by joining #gstreamer @ FreeNode.

Documentation

Currently, the best way to understand the API is to read the examples. This post breaking down the API should help with that:

http://blog.nirbheek.in/2018/02/gstreamer-webrtc.html

Examples

sendrecv: Send and receive audio and video

Running the C version

$ gcc webrtc-sendrecv.c $(pkg-config --cflags --libs gstreamer-webrtc-1.0 gstreamer-sdp-1.0 libsoup-2.4 json-glib-1.0) -o webrtc-sendrecv

Running the Python version

The python version requires at least version 1.14.2 of gstreamer and its plugins.

Running the Rust version

With all versions, you will see a bouncing ball + hear red noise in the browser, and your browser's webcam + mic in the gst app.

You can pass a --server argument to all versions, for example --server=wss://127.0.0.1:8443.

Running the Java version

cd sendrecv/gst-java\ ./gradlew build\ java -jar build/libs/gst-java.jar --peer-id=ID with the id from the browser.

You can optionally specify the server URL too (it defaults to wss://webrtc.nirbheek.in:8443):

java -jar build/libs/gst-java.jar --peer-id=1 --server=ws://localhost:8443

multiparty-sendrecv: Multiparty audio conference with N peers

$ gcc mp-webrtc-sendrecv.c $(pkg-config --cflags --libs gstreamer-webrtc-1.0 gstreamer-sdp-1.0 libsoup-2.4 json-glib-1.0) -o mp-webrtc-sendrecv

TODO: Selective Forwarding Unit (SFU) example

TODO: Multipoint Control Unit (MCU) example