seek problem when synchronized with net clock provider

Nicolas Dufresne nicolas.dufresne at collabora.com
Thu May 21 10:54:34 PDT 2015


Le Thursday 21 May 2015 à 06:42 -0700, modelvincent a écrit :
> 
> However, Now I have a problem with the seek, If I want to seek from
> master
> or from slave side, the player were I asked to seek go to the good
> position,
> but the second stay at the same place, and morever they start both to
> read
> at full speed, without synchronization or anything.
> 
> If I pause my 2 player, they are Pausing correctly, and If I Play on
> the
> player where I've done the seek, he go back to a normal speed, but
> not the
> second one who continue to play at full speed...
> 
> I don't understand the problem... :(

This is where Aurena get complicated. First, I am very unsure if your
model of a master/slave player can actually work. When I implemented
that in Aurena, I made my life simpler by only having synchronized
player (so I don't need to cope with two use cases).
On the server side, a seek is sent to the clients as "base-time" and
"position". The position is the position from the start of the media,
while base-time is from the following formula:
  base_time = time_now - position + SEEK_DELAY
time_now is read from the network clock of course. The SEEK_DELAY is
needed, as otherwise at the end of their preroll, all player would
already be late and then play full speed. More advanced solution to
that, would be to operate the seek in paused state on all clients and
add a indication from client to server indicating when the preroll has
finished. But Aurena is taking a simplier route here.
On client side, upon reception of a seek, Aurena will save the new
position and base time. It will then do an accurate seek to the
position, and update the GStreamer base_time taking into account the
seek.
  gst_element_set_base_time (pipeline, base_time + position);
This entirely depends on the precision of the seek. Again, this is a
shortcut, an ideal solution would wait for the seek to complete, re
-read the position at that moment and offset taking into account the
error.
For the play pause case. The server does not pass anything special on
the play message. Though, on the pause message, the server will pass a
"position". This indicate the player where they should be at when they
are actually paused. Again, Aurena take a small short cut, instead of
letting the stream play until that point, it will simply pause the
pipeline, and seek to the pause position (saving that position). When
play message is received, it will update the base_time like in the
seek, and set the state to playing.
There is one more case you might not have covered yet. When a player
join a synchronization party, it's likely that you want this player to
also seek to the current position. This allow quick synchronization of
new player.  Position is computed by client this way:
  position = now - base_time
The code source can be found at: git//github.com/thaytan/aurena.git.
Hope this was useful.
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150521/92131d6e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150521/92131d6e/attachment.sig>


More information about the gstreamer-devel mailing list