comparison 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
comparison
equal deleted inserted replaced
33154:f6a049eff960 33155:16e5b7f9ddb8
2168 reinit_audio_chain(); 2168 reinit_audio_chain();
2169 } 2169 }
2170 return 1; 2170 return 1;
2171 } 2171 }
2172 2172
2173 static void handle_udp_master(double time)
2174 {
2175 #ifdef CONFIG_NETWORKING
2176 if (udp_master) {
2177 char current_time[256];
2178 snprintf(current_time, sizeof(current_time), "%f", time);
2179 send_udp(udp_ip, udp_port, current_time);
2180 }
2181 #endif /* CONFIG_NETWORKING */
2182 }
2183
2173 static int sleep_until_update(float *time_frame, float *aq_sleep_time) 2184 static int sleep_until_update(float *time_frame, float *aq_sleep_time)
2174 { 2185 {
2175 int frame_time_remaining = 0; 2186 int frame_time_remaining = 0;
2176 current_module="calc_sleep_time"; 2187 current_module="calc_sleep_time";
2177 2188
2233 2244
2234 // flag 256 means: libvo driver does its timing (dvb card) 2245 // flag 256 means: libvo driver does its timing (dvb card)
2235 if (*time_frame > 0.001 && !(vo_flags&256)) 2246 if (*time_frame > 0.001 && !(vo_flags&256))
2236 *time_frame = timing_sleep(*time_frame); 2247 *time_frame = timing_sleep(*time_frame);
2237 2248
2238 #ifdef CONFIG_NETWORKING 2249 handle_udp_master(mpctx->sh_video->pts);
2239 if (udp_master) {
2240 char current_time[256];
2241 snprintf(current_time, sizeof(current_time), "%f", mpctx->sh_video->pts);
2242 send_udp(udp_ip, udp_port, current_time);
2243 }
2244 #endif /* CONFIG_NETWORKING */
2245 2250
2246 return frame_time_remaining; 2251 return frame_time_remaining;
2247 } 2252 }
2248 2253
2249 int reinit_video_chain(void) { 2254 int reinit_video_chain(void) {
2532 new_cache_fill); 2537 new_cache_fill);
2533 old_cache_fill = new_cache_fill; 2538 old_cache_fill = new_cache_fill;
2534 } 2539 }
2535 } 2540 }
2536 #endif 2541 #endif
2542 handle_udp_master(mpctx->sh_video->pts);
2537 usec_sleep(20000); 2543 usec_sleep(20000);
2538 } 2544 }
2539 if (cmd && cmd->id == MP_CMD_PAUSE) { 2545 if (cmd && cmd->id == MP_CMD_PAUSE) {
2540 cmd = mp_input_get_cmd(0,1,0); 2546 cmd = mp_input_get_cmd(0,1,0);
2541 mp_cmd_free(cmd); 2547 mp_cmd_free(cmd);