1

i have a question regarding Webrtc in Gstreamer. I am relatively new to the frame work and i am not sure if what i want to achieve is possible.

I have a Webrtc peer i wish to connect to and retrieve an audio stream. I wish then to pipe the same stream to another webrtc peer at a different endpoint.

I can achieve both of these aspects individually, i.e :

  1. consume webrtc stream and sink it.
  2. stream audio over webrtc

Is this possible? if so does anyone know of any examples on how to achieve this? Python preferred, but C works fine too. Also if an example doesnt exist, if someone could be so kind as to describe how this could work..

TIA

jmyth742
  • 35
  • 7
  • Hi. Did you manage to figure this out? I'm trying to integrate native WebRTC with GStreamer in C++. Somehow I need to feed video from a GStreamer sink to a WebRTC VideoTrack. Having no experience with either library until now, this is proving rather tricky! Any help/tips would be greatly appreciated! (I'm comfortable in Python as well btw.) – BuvinJ May 20 '22 at 15:35
  • did you find this in the end? i have now a lot of experience with this... :) better late than never!! haha – jmyth742 Jan 05 '23 at 08:47

1 Answers1

0

Gstreamer is not the right tool for the job since it is a media-handling library. In the scope of WebRTC, Gstreamer would be responsible for decoding the media stream to eventually do something with that, say for instance display a video or play an audio. It would work more or less in the following fashion:

# Real Time Protocol socket (WebRTC over the network)
[peer A > rtp (udp) stream > peer B]

# Network layer from peer B to media layer in peer B machine
[peer B > rtp stream (local pipe/udp) > Gstreamer pipeline]

# GStreamer pipeline
[src (e.g. udpsrc, appsrc) > rtpdepay (e.g. rtph264depay, rtpopusdepay) > rtp payload filter > decode (e.g. avdec_h264, opusdec) > ... > sink (e.g. autovideosink, autoaudiosink)]

What you are trying to is just bypass the data, so since you are not planning to do any sort of handling with the data, Gstreamer is not really required for your workflow.

# Real Time Protocol socket (WebRTC over the network)
[peer A > rtp (udp) stream > peer B.1]

# Bypass
[peer B.1 > rtp stream (local pipe/udp) > peer B.2]

# Real Time Protocol socket (WebRTC over the network)
[peer B.2 > rtp (udp) stream > peer C]

That said, it looks very much like you're relaying the peer connection, which is what TURN servers are meant for. Maybe it is work to have a look at that as well.

flejz
  • 41
  • 4