multiple audio rtp stream synchronization

Mikkel Pihl voks at vokskabinet.com
Wed May 15 11:52:22 UTC 2019


Dear all,

I am trying to synchronize two audio streams sent over RTP and am not
getting the results i hoped for.

I have three devices where the system time is synchronized using PTP. Two
of these devices are are running an RTP server streaming sampled audio to a
RTP client running on the third device. On the RTP server devices i have
synchronized the sampling clock to PTP. I have measured the sampling time
and system clock to be synchronized with an accuracy better than 100 ns.

If i connect the same signal generator output to both servers and listen to
the received streams on the RTP client device, there are phase differences
in the ms range. The phase difference is changing with each RTCP packet.

Below is my RTP server and client setup. It is based on information found
on this list. I would like to know if any of you can see some obvious
mistakes.

The RTP servers are an C implementation of the pipelines

gst-launch-1.0 -v rtpbin name=rtpbin alsasrc !
audio/x-raw,format=S32LE,rate=48000,width=32,depth=32,channels=2 !
audioconvert ! rtpL24pay ! rtpbin.send_rtp_sink_0    rtpbin.send_rtp_src_0
! udpsink host=192.168.0.1 port=5002 rtpbin.send_rtcp_src_0 ! udpsink
host=192.168.0.1 port=5003 sync=false async=false udpsrc port=5007 !
rtpbin.recv_rtcp_sink_0

gst-launch-1.0 -v rtpbin name=rtpbin alsasrc !
audio/x-raw,format=S32LE,rate=48000,width=32,depth=32,channels=2 !
audioconvert ! rtpL24pay ! rtpbin.send_rtp_sink_0    rtpbin.send_rtp_src_0
! udpsink host=192.168.0.1 port=5008 rtpbin.send_rtcp_src_0 ! udpsink
host=192.168.0.1 port=5009 sync=false async=false udpsrc port=5013 !
rtpbin.recv_rtcp_sink_0

The RTP client is a C implementation of the pipeline

gst-launch-1.0 -v rtpbin name=rtpbin udpsrc
caps="application/x-rtp,media=(string)audio,clock-rate=(int)48000,encoding-name=(string)L24,encoding-params=(string)2,channels=(int)2,
payload=(int)96" port=5002 ! rtpbin.recv_rtp_sink_0 rtpbin. ! rtpL24depay !
audioconvert ! alsasink udpsrc port=5003 ! rtpbin.recv_rtcp_sink_0
rtpbin.send_rtcp_src_0 ! udpsink host=192.168.0.2 port=5007 sync=false
async=false udpsrc
caps="application/x-rtp,media=(string)audio,clock-rate=(int)48000,encoding-name=(string)L24,encoding-params=(string)2,channels=(int)2,
payload=(int)96" port=5008 ! rtpbin.recv_rtp_sink_1 rtpbin. ! rtpL24depay !
audioconvert ! alsasink udpsrc port=5009 ! rtpbin.recv_rtcp_sink_1
rtpbin.send_rtcp_src_1 ! udpsink host=192.168.0.3 port=5013 sync=false
async=false

In order to achive synchronization i add the following properties to the
RTP server rtpbin

g_object_set(rtpbin, "ntp-time-source", 0, "rtcp-sync-send-time", FALSE,
NULL);

and the following properties to the RTP client rtpbin

g_object_set(rtpbin, "ntp-time-source", 0, "buffer-mode", 4, "ntp-sync",
TRUE, NULL);

All the best,
Mikkel Pihl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190515/7a7a2dc7/attachment.html>


More information about the gstreamer-devel mailing list