diff mplayer.c @ 36005:3be3990375da

Add -heartbeat-interval option. Patch by Android Jack [jackdroido gmail], with minor modification and man page update by me.
author reimar
date Sat, 30 Mar 2013 08:42:57 +0000
parents 389d43c448b3
children 134919b73b04
line wrap: on
line diff
--- a/mplayer.c	Sat Mar 30 03:32:16 2013 +0000
+++ b/mplayer.c	Sat Mar 30 08:42:57 2013 +0000
@@ -146,6 +146,7 @@
 float start_volume = -1;
 double start_pts   = MP_NOPTS_VALUE;
 char *heartbeat_cmd;
+float heartbeat_interval = 30.0;
 static int max_framesize;
 
 int noconsolecontrols;
@@ -3818,7 +3819,9 @@
                 if (heartbeat_cmd) {
                     static unsigned last_heartbeat;
                     unsigned now = GetTimerMS();
-                    if (now - last_heartbeat > 30000) {
+                    // compare as unsigned so that any mistakes (overflow etc)
+                    // trigger a heartbeat, thus resetting the logic.
+                    if (now - last_heartbeat > (unsigned)(heartbeat_interval * 1000)) {
                         last_heartbeat = now;
                         system(heartbeat_cmd);
                     }