gstrtpbin with UDP Multicast for Sync Audio Playback on Multiple Clients
Endejan, Edward
Edward.Endejan at dmh-global.com
Thu Jun 14 13:56:56 PDT 2012
Hello again,
I have not found a solution to this so far.
As an alternative, does anyone have sample code they would be willing to share which acts as an RTSP client for synchronous playback to use with the example RTSP servers included with the rtsp-server project?
UDP multicast is not a firm requirement for me - UDP unicast to multiple clients may be acceptable. But synchronous audio playback whereby the audio packets are rendered at the timestamp associated with the buffers is a definite requirement.
I have attempted to do this with a pipeline such as "rtspsrc ! gstrtpjitterbuffer ! rtpmpadepay ! mp3parse ! mad ! audiorate ! volume ! alsasink" with properties of alsasink such as sync=true, max-lateness=45000000, qos=true, slave-method=2 (none), and ts-offset=200000000. I have tried tweaks to these values and a few other of alsasink's properties, but to no avail. But my interpretation of the behavior I've seen is that alsasink only truly synchronizes the first buffer to the timestamp associated with that first buffer. From that point on it assumes that the DAC clock is the reference clock and ignores any of the remaining timestamps at least until a new segment is started. This is actually a function of gstbsaeaudiosink from which alsasink is derived (through gstaudiosink). Is my interpretation correct? If not, corrections/clarifications are welcome.
Can anyone offer suggestions of what else to try in order to achieve synchronous audio playback on multiple clients?
Regards,
Ed
From: gstreamer-devel-bounces+edward.endejan=dmh-global.com at lists.freedesktop.org [mailto:gstreamer-devel-bounces+edward.endejan=dmh-global.com at lists.freedesktop.org] On Behalf Of Mohammad Afaneh
Sent: Wednesday, June 13, 2012 4:56 PM
To: Discussion of the development of and with GStreamer
Subject: Re: gstrtpbin with UDP Multicast for Sync Audio Playback on Multiple Clients
Hi,
Anyone have an answer for this question? I was searching the archives for threads related to synchronous audio playback for multiple clients and found this thread.
If anyone has any input on this subject/problem your help would be appreciated.
Thanks,
Mohammad
On Wed, Feb 29, 2012 at 11:21 AM, Endejan, Edward <Edward.Endejan at dmh-global.com<mailto:Edward.Endejan at dmh-global.com>> wrote:
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
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org<mailto:gstreamer-devel at lists.freedesktop.org>
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120614/c0d7e2ee/attachment.html>
More information about the gstreamer-devel
mailing list