pollen-robotics / gst-signalling-py

Python implementation of the Gstreamer signalling
Apache License 2.0
1 stars 0 forks source link

gst-signalling-py: Gstreamer WebRTC signalling in Python

Code style: black linter pytest coverage

This repository provides a Python implementation of the Gstreamer WebRTC signalling protocol.

It provides an API close to the gstreamer API with a producer and a consumer. This allows to simply write producer/consumer examples using gstreamer signalling. It works with single producer and multiple consumers for exchanging data. See the data producer example for more details.

It also provides tools to list and monitor the peers connected to a signalling server.

Note that there is no example of audiovideo streaming. Gstreamer provides rust plugins that directly communicate with a signalling server

Installation

Simply install the package using pip:

pip install -e .

Usage

See the examples for more details.

Protocol

Roles

Gstreamer signalling defines 3 roles (so the WebRTC peers are not symmetrical)

Protocol sequence diagram

sequenceDiagram
  Server-->>Producer: Welcome (PeerId)
    Server-->>Consumer: Welcome (PeerId)
  Producer->>Server: PeerStatusChanged  # declare yourself as producer
    Consumer->>Server: StartSession # with producer PeerId
    Server-->>Producer: StartSession (SessionId)
    Server-->>Consumer: SessionStarted (SessionId)
    Producer->>Server: Peer (offer sdp)
    Server-->>Consumer: Peer (offer sdp)
    Consumer->>Server: Peer (answer sdp)
    Server-->>Producer: Peer (answer sdp)

See this page for more details.

Contribute

Please refer to our template repository for guidlines and coding style.

Development tools can be installed with

pip install -e .[dev]

Unit tests

The gstreamer signalling server is required to run on the localhost. Then run

pytest