]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Make it possible to adjust the transport start grace period
authorAndreas Öman <andreas@lonelycoder.com>
Sat, 9 Jan 2010 18:55:09 +0000 (18:55 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sat, 9 Jan 2010 18:55:09 +0000 (18:55 +0000)
src/dvb/dvb_transport.c
src/iptv_input.c
src/transports.c
src/tvhead.h
src/v4l.c

index 4492791fd76e5a617d3be21e61dff1e7617cf131..f5e5fc8fb30957e43adbab8591025e10947d095c 100644 (file)
@@ -325,6 +325,16 @@ dvb_transport_setsourceinfo(th_transport_t *t, struct source_info *si)
 }
 
 
+/**
+ *
+ */
+static int
+dvb_grace_period(th_transport_t *t)
+{
+  return 10;
+}
+
+
 /**
  * Find a transport based on 'serviceid' on the given mux
  *
@@ -361,14 +371,15 @@ dvb_transport_find(th_dvb_mux_instance_t *tdmi, uint16_t sid, int pmt_pid,
   t->tht_dvb_service_id = sid;
   t->tht_pmt_pid        = pmt_pid;
 
-  t->tht_start_feed = dvb_transport_start;
-  t->tht_refresh_feed = dvb_transport_refresh;
-  t->tht_stop_feed  = dvb_transport_stop;
-  t->tht_config_save = dvb_transport_save;
+  t->tht_start_feed    = dvb_transport_start;
+  t->tht_refresh_feed  = dvb_transport_refresh;
+  t->tht_stop_feed     = dvb_transport_stop;
+  t->tht_config_save   = dvb_transport_save;
   t->tht_setsourceinfo = dvb_transport_setsourceinfo;
-  t->tht_dvb_mux_instance = tdmi;
   t->tht_quality_index = dvb_transport_quality;
+  t->tht_grace_period  = dvb_grace_period;
 
+  t->tht_dvb_mux_instance = tdmi;
   LIST_INSERT_HEAD(&tdmi->tdmi_transports, t, tht_group_link);
 
   pthread_mutex_lock(&t->tht_stream_mutex); 
index 75c9db14884a4f058bcabea1470688adc943b08f..adc10e7cb58ebd79109457a950b42f7a1e836fff 100644 (file)
@@ -363,6 +363,16 @@ iptv_transport_setsourceinfo(th_transport_t *t, struct source_info *si)
 }
 
 
+/**
+ *
+ */
+static int
+iptv_grace_period(th_transport_t *t)
+{
+  return 3;
+}
+
+
 /**
  *
  */
@@ -402,6 +412,7 @@ iptv_transport_find(const char *id, int create)
   t->tht_config_save   = iptv_transport_save;
   t->tht_setsourceinfo = iptv_transport_setsourceinfo;
   t->tht_quality_index = iptv_transport_quality;
+  t->tht_grace_period  = iptv_grace_period;
   t->tht_iptv_fd = -1;
 
   LIST_INSERT_HEAD(&iptv_all_transports, t, tht_group_link);
index 049ee0f7906c9d190f20c77c78057cca606a3b14..5da375d0139a604ed96f88f2e6ae62b2eef27f9d 100644 (file)
@@ -267,6 +267,8 @@ transport_start(th_transport_t *t, unsigned int weight, int force_start,
 {
   th_stream_t *st;
   int r, err;
+  int timeout = 2;
+  struct timespec to;
 
   lock_assert(&global_lock);
 
@@ -293,7 +295,9 @@ transport_start(th_transport_t *t, unsigned int weight, int force_start,
   cwc_transport_start(t);
   capmt_transport_start(t);
 
-  int timeout = 10;
+  if(t->tht_grace_period != NULL)
+    timeout = t->tht_grace_period(t);
+
 
   gtimer_arm(&t->tht_receive_timer, transport_data_timeout, t, timeout);
 
@@ -305,8 +309,6 @@ transport_start(th_transport_t *t, unsigned int weight, int force_start,
 
   pthread_mutex_lock(&t->tht_stream_mutex);
 
-  struct timespec to;
-
   to.tv_sec = time(NULL) + timeout;
   to.tv_nsec = 0;
 
index 3d9cc3c641d52fb410a25a01e79c6cbe8a24c672..5da459f5edc4bc7cf927f5adfb8dc0e4154db04f 100644 (file)
@@ -475,6 +475,7 @@ typedef struct th_transport {
 
   int (*tht_quality_index)(struct th_transport *t);
 
+  int (*tht_grace_period)(struct th_transport *t);
 
   /*
    * Per source type structs
index 4b5ac648a7d704ec5a66e2dd94a8fd03c55ff0ce..2d76d305a1d0cf43fa2be6be4eb4980aff577569 100644 (file)
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -303,6 +303,16 @@ v4l_transport_quality(th_transport_t *t)
 }
 
 
+/**
+ *
+ */
+static int
+v4l_grace_period(th_transport_t *t)
+{
+  return 2;
+}
+
+
 /**
  * Generate a descriptive name for the source
  */
@@ -359,6 +369,7 @@ v4l_transport_find(v4l_adapter_t *va, const char *id, int create)
   t->tht_config_save   = v4l_transport_save;
   t->tht_setsourceinfo = v4l_transport_setsourceinfo;
   t->tht_quality_index = v4l_transport_quality;
+  t->tht_grace_period  = v4l_grace_period;
   t->tht_iptv_fd = -1;
 
   pthread_mutex_lock(&t->tht_stream_mutex);