Mercurial > mplayer.hg
diff mplayer.c @ 33155:16e5b7f9ddb8
Send udp master updates also when paused and let slave use normal timing
when it gets no messages.
This allows the slave to continue playing normally if the master crashes
or network stops working instead of hanging forever.
Note that the slave might still hang for the 30 second network timeout
in some cases.
author | reimar |
---|---|
date | Sat, 09 Apr 2011 14:55:22 +0000 |
parents | f6a049eff960 |
children | ddbd34d6392d |
line wrap: on
line diff
--- a/mplayer.c Sat Apr 09 14:47:16 2011 +0000 +++ b/mplayer.c Sat Apr 09 14:55:22 2011 +0000 @@ -2170,6 +2170,17 @@ return 1; } +static void handle_udp_master(double time) +{ +#ifdef CONFIG_NETWORKING + if (udp_master) { + char current_time[256]; + snprintf(current_time, sizeof(current_time), "%f", time); + send_udp(udp_ip, udp_port, current_time); + } +#endif /* CONFIG_NETWORKING */ +} + static int sleep_until_update(float *time_frame, float *aq_sleep_time) { int frame_time_remaining = 0; @@ -2235,13 +2246,7 @@ if (*time_frame > 0.001 && !(vo_flags&256)) *time_frame = timing_sleep(*time_frame); -#ifdef CONFIG_NETWORKING - if (udp_master) { - char current_time[256]; - snprintf(current_time, sizeof(current_time), "%f", mpctx->sh_video->pts); - send_udp(udp_ip, udp_port, current_time); - } -#endif /* CONFIG_NETWORKING */ + handle_udp_master(mpctx->sh_video->pts); return frame_time_remaining; } @@ -2534,6 +2539,7 @@ } } #endif + handle_udp_master(mpctx->sh_video->pts); usec_sleep(20000); } if (cmd && cmd->id == MP_CMD_PAUSE) {