srt: add support for SRT connection multiplexing
The underlying SRT library supports multiplexing SRT connections over the same UDP socket. This is useful for avoiding complicated firewall discussions with IT departments, instead one can use a single address for your SRT ingress or egress.
This commit introduces a new property connection-key
if two SRT listening elements have the same value set as connction-key
they will attempt to share the UDP socket.
We introduce a new GstSRTListenerConnection
helper struct with a helper API to go with it that will help us keep track of active listening sockets. Most of The code dealing with listening and waiting for callers is moved there from gstsrtobject.c
. A global hash table will store the different connections with the connection-key
as key.
Example usage:
$ gst-launch-1.0 -v \
srtsrc connection-key=multiplex uri="srt://127.0.0.1:3000?mode=listener&streamid=one" ! tsparse ! queue ! filesink location=one.ts \
srtsrc connection-key=multiplex uri="srt://127.0.0.1:3000?mode=listener&streamid=two" ! tsparse ! queue ! filesink location=two.ts
$ gst-launch-1.0 -v \
mpegtsmux name=muxone alignment=7 \
mpegtsmux name=muxtwo alignment=7 \
videotestsrc pattern=ball ! queue ! "video/x-raw,width=320,height=240" ! x264enc ! muxone. \
videotestsrc ! queue ! "video/x-raw,width=320,height=240" ! x264enc ! muxtwo. \
muxone. ! queue ! srtsink uri="srt://127.0.0.1:3000?mode=caller&streamid=one" \
muxtwo. ! queue ! srtsink uri="srt://127.0.0.1:3000?mode=caller&streamid=two"