gstrtpbin with UDP Multicast for Sync Audio Playback on Multiple Clients
Endejan, Edward
Edward.Endejan at dmh-global.com
Wed Feb 29 08:21:10 PST 2012
Hello,
Is it possible, and if so has anyone been successful in using gstrtpbin from the command line with gst-launch to stream audio (or video, or both) through UDP multicast and receive it on multiple clients which playback the audio in sync? I have seen one post which indicates this is not possible from a gst-launch command line because some unique session parameters such as ssrc, clock-base, and seqnum-base from the server need to be available to the clients. I have tried manually copying these parameters to the client(s) after the session is started on the server, but that has not helped. It is also not clear to me whether gstrtpbin will allow for synchronizing playback on multiple clients, or only synchronize multiple streams on a single client. In addition, I'm hoping it compensates for slight differences in clock rates between the server and the client(s).
I have searched through the documentation and the mailing list archives, but have not found an example which is claimed to have worked. The online documentation for gstrtpbin gives example command lines for streaming audio and video, which I've adapted to stream only audio, but the results I get are intermittent at best. Sometimes the audio starts to play back fine for a while and then starts breaking up, but most of the time it stutters and skips from the beginning and often times it stops completely. I have simplified my test case to stream only to localhost (127.0.0.1) and run the server and client on the same device to eliminate any physical network issues or clock mismatch issues, but still the problems persist.
I saw a recent post by Matthias Dodt which is very similar, and though he is trying to stream video instead, it is not working for him either.
Here are the command lines I'm using:
SERVER:
gst-launch -v gstrtpbin name=rtpbin \
audiotestsrc num-buffers=3000 samplesperbuffer=441 wave=0 freq=1000 volume=1 is-live=true !\
"audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2" !\
audioconvert !\
"audio/x-raw-int, endianness=(int)4321, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2" !\
rtpL16pay !\
rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink host=127.0.0.1 port=5002 \
rtpbin.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5003 sync=false async=false \
udpsrc multicast-group=127.0.0.1 port=5007 ! rtpbin.recv_rtcp_sink_0
CLIENT:
gst-launch -v --gst-debug=baseaudiosink:5 gstrtpbin name=rtpbin \
udpsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)44100, encoding-name=(string)L16, encoding-params=(string)2, channels=(int)2" \
multicast-group=127.0.0.1 port=5002 !\
rtpbin.recv_rtp_sink_0 rtpbin. !\
rtpL16depay !\
queue2 max-size-bytes=204800 use-buffering=true ring-buffer-max-size=204800 !\
"audio/x-raw-int, endianness=(int)4321, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2" !\
audioconvert !\
"audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2" !\
alsasink device=plughw:0,1 drift-tolerance=10000 slave-method=1 sync=true \
udpsrc multicast-group=127.0.0.1 port=5003 ! \
rtpbin.recv_rtcp_sink_0 \
rtpbin.send_rtcp_src_0 !\
udpsink host=127.0.0.1 port=5007 sync=false async=false
I intend to write an application eventually, but for now would like to verify proper operation using only the command line if possible. The other reason I want to verify this using a set of command lines rather than developing a full-blown application is that I hope to profile the CPU load for several use cases to ensure the feasibility of what I'm trying to do with a given hardware platform.
Any guidance would be appreciated.
Regards,
Ed Endejan
More information about the gstreamer-devel
mailing list