[MPlayer-users] UDP -udp-slave video sync

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jun 9 19:30:24 CEST 2011

On Wed, Jun 08, 2011 at 10:49:48PM +0100, Rob Canning wrote:
> brief addendum to the reply inline below... sorry for noise..
> the sync between the audio/video on the individual slaves seems to
> be erratic - sometimes i start it and its perfect and sometime its
> up to around 20 frames out of sync - once its rolling and in sync it
> remains in sync and does not drift - but the randomness of when it
> starts in sync and when it doesnt is whats stoping it being a
> solution atm

It definitely _will_ drift, even if it might not be enough to
matter for your use case.
However if only initial sync is an issue it might help to change
the code to start audio playback only once the first packet
from the master has been received.
It's not acceptable for SVN as-is, but something like this:
Index: mplayer.c
--- mplayer.c   (revision 33574)
+++ mplayer.c   (working copy)
@@ -3803,11 +3803,16 @@
 /*========================== PLAY AUDIO ============================*/
+            static int udp_slave_startup = 1;
+            if (!udp_slave || !udp_slave_startup)
             if (mpctx->sh_audio)
                 if (!fill_audio_out_buffers())
                     // at eof, all audio at least written to ao
                     if (!mpctx->sh_video)
                         mpctx->eof = PT_NEXT_ENTRY;
+            udp_slave_startup = 0;
             if (!mpctx->sh_video) {
                 // handle audio-only case:

More information about the MPlayer-users mailing list