[dvblast-devel] refractory period: avoid triggering wdog too often

Christophe Massiot git at videolan.org
Wed Oct 23 21:27:10 CEST 2013


dvblast | branch: master | Christophe Massiot <massiot at via.ecp.fr> | Wed Oct 23 21:26:02 2013 +0200| [03287af1b62452e318a0fd9191aeb8f3cdef8418] | committer: Christophe Massiot

refractory period: avoid triggering wdog too often

> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=03287af1b62452e318a0fd9191aeb8f3cdef8418
---

 config.h |    1 +
 demux.c  |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/config.h b/config.h
index 55a32d7..112b7c7 100644
--- a/config.h
+++ b/config.h
@@ -40,6 +40,7 @@
 #define DEFAULT_IPV6_MTU 1280
 #define PADDING_PID 8191
 #define WATCHDOG_WAIT 10000000LL
+#define WATCHDOG_REFRACTORY_PERIOD 60000000LL
 #define MAX_ERRORS 1000
 #define DEFAULT_VERBOSITY 4
 #define MAX_POLL_TIMEOUT 100000 /* 100 ms */
diff --git a/demux.c b/demux.c
index f2c8486..38e6a3b 100644
--- a/demux.c
+++ b/demux.c
@@ -102,6 +102,7 @@ static mtime_t i_last_dts = -1;
 static int i_demux_fd;
 static int i_nb_errors = 0;
 static mtime_t i_last_error = 0;
+static mtime_t i_last_reset = 0;
 
 #ifdef HAVE_ICONV
 static iconv_t iconv_handle = (iconv_t)-1;
@@ -482,8 +483,12 @@ static void demux_Handle( block_t *p_ts )
                              < p_ts->p_ts + TS_SIZE
                           && !pes_validate(p_payload) ) )
                 {
-                    p_output->i_nb_errors++;
-                    p_output->i_last_error = i_wallclock;
+                    if ( i_wallclock >
+                            i_last_reset + WATCHDOG_REFRACTORY_PERIOD )
+                    {
+                        p_output->i_nb_errors++;
+                        p_output->i_last_error = i_wallclock;
+                    }
                 }
                 else if ( i_wallclock > p_output->i_last_error + WATCHDOG_WAIT )
                     p_output->i_nb_errors = 0;
@@ -497,6 +502,7 @@ static void demux_Handle( block_t *p_ts )
                     msg_Warn( NULL,
                              "too many errors for stream %s, resetting",
                              p_output->config.psz_displayname );
+                    i_last_reset = i_wallclock;
                     en50221_Reset();
                 }
             }



More information about the dvblast-devel mailing list