[MPlayer-dev-eng] [PATCH] Network synchronized playback using UDP

Uoti Urpala uoti.urpala at pp1.inet.fi
Tue Mar 24 01:46:55 CET 2009


On Mon, 2009-03-23 at 14:22 -0700, Jason Holt wrote:
> I've updated the patch so that the master sends out its datagram just before
> the screen update, instead of sending it before it sleeps in anticipation of
> the update.  Simple enough.  This should keep the slaves in sync when simply
> playing through a file with no seeking.
> 
> Uoti was also correct that the slaves end up one frame behind after a seek,
> since the master doesn't send out a datagram until the frame after the
> seek.  I'm happy to fix that as well if it's worth the extra complexity (for
> my purposes, being 1 frame behind isn't very noticeable).
> 
> The problem of constant seeking when the keyframes are spaced just right is
> a trickier issue.  My inclination is to tell the user "don't do that", since
> people building video walls probably have some control over the encoding of
> their videos.  But I'm also happy to try to address it; perhaps the slaves
> could check after seeking to see if advancing a frame without waiting for
> the master would get them closer to the master's position.

I think a more reliable version that would also correct the "lag behind"
problem could be done without much complexity by storing the last
position received from master. Something like this:

while True:
    closebehind = master.pts - THRESHOLD < self.pts <= master.pts
    # If nonblocking we just check whether we already received a new UDP packet
    master.update_pts(blocking=not closebehind)
    if (abs(self.pts - master.pts) > THRESHOLD):
        self.seek(master.pts)
        break
    if (self.pts <= master.pts):
        break





More information about the MPlayer-dev-eng mailing list