How to synchronize playback against system clock?

Alexander Kanavin alexander.kanavin at intel.com
Thu Feb 14 04:06:17 PST 2013


Hi,

recent UPnP AV standards have added a synchronized playback feature, 
which allows several network players to render the same content (or 
various channels of that content) simultaneously and in sync. The use 
case is for example multi-room playback, or reducing the amount of 
cables that connect A/V equipment in the same room. Also, proprietary, 
expensive systems like Sonos have had this feature for a long time.

If you want to see technical details, a general overview is available in 
this document, pages 29-31:
http://upnp.org/specs/av/UPnP-av-AVArchitecture-v2.pdf
and the protocol details are scattered around this document, but the 
most important parts are on pages 77-78 and 99-102:
http://upnp.org/specs/av/UPnP-av-AVTransport-v3-Service.pdf

I've done a bit of investigation about how this could be supported by 
Rygel and GStreamer, and the central question is this: how can we set up 
playback in a way that guarantees that at a point x in system time the 
playback is exactly at position y in the stream. I've identified two 
approaches, but neither is entirely satisfactory:

1) Instruct the pipeline to use a system clock, then disable the 
distribution of base time with gst_element_set_start_time() and 
manipulate the base_time manually with gst_element_set_base_time(). The 
problem here is that the system clock is not an optimal choice for 
playback, and in fact I hear audio artifacts when it's used.

2) Keep using the default clock, but issue a seek request to the 
pipeline according to the current value of the system clock. The problem 
here is that there is an unpredictable delay between the request and the 
position adjustment - my quick tests showed it to be about 0.3 ms (about 
15 audio samples) - it's not too bad, but I'd like to achieve sub-sample 
accuracy.

Have I missed something? How would you do this?

Regards,
Alexander


More information about the gstreamer-devel mailing list