streaming over network to multiple clients in sync

John Ruemker john.ruemker at gmail.com
Wed Feb 15 07:40:11 PST 2012


Hey all,
I am a relative gstreamer n00b, but I've read the application 
development manual and gone through as many pipeline examples as I can 
find to try and get up to speed.

I'm trying to figure out the ideal pipeline for streaming over the 
network to multiple clients.  The test I'm working with now is 720p mkvs 
using filesrc on the server streaming to multiple clients that will need 
to play back in-sync (more on that below).  I've come up with a number 
of different pipelines that will stream it and play on the clients, but 
the main two problems I need help solving are:

a) Performance.  I can't seem to get smooth playback on the client in 
any of the pipelines I've tried.  Most of them have been pieced together 
from examples I've found (I still don't have much familiarity with the 
different plugins), so its quite possible I'm doing something stupid or 
missing an important setting.  I'm able to play the same file over NFS 
using different gstreamer players, so I'm convinced its something in the 
pipeline.  Here's an example of what I've tried:

### server
# gst-launch -v gstrtpbin name=rtpbin filesrc location=file.mkv ! 
decodebin ! x264enc ! rtph264pay ! queue max-size-buffers=2 
max-size-time=0 max-size-bytes=0  ! rtpbin.send_rtp_sink_0 
rtpbin.send_rtp_src_0 ! udpsink host=192.168.2.2 port=5000 
rtpbin.send_rtcp_src_0 ! udpsink preroll-queue-len=10000 port=5001 
sync=false async=false udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0

### client
# gst-launch udpsrc port=5000 caps="application/x-rtp, 
media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" 
! .recv_rtp_sink_0     gstrtpbin ! decodebin ! xvimagesink

I've also tried without RTP, tcp instead of udp, and tweaking some of 
the buffer/preroll settings to no avail.  Anyone have a good example of 
a pipeline that performs well over the network?

b) Playing in sync on multiple clients. I need playback to be 
synchronized on the clients, but can't figure out how to do so.  I 
understand that I can use gst_net_time_provider_new() and 
gst_net_client_clock_new(), but as I understand that will only cause the 
client to use the same clock for playback, but their position in the 
streams will not be synchronized.  Any idea how I can accomplish this?  
Ideally the pipeline would be set up such that if I pause or set the 
position on the client it would carry back to the server and propagate 
to the other clients, but if the only way is to communicate from 
client->server at an application level to have the server do it, that's 
fine.

Thanks in advance for any help you can provide!

-John


More information about the gstreamer-devel mailing list