Make it possible to adjust the transport start grace period

This commit is contained in:
Andreas Öman 2010-01-09 18:55:09 +00:00
parent 8796663919
commit d64268c1d9
5 changed files with 44 additions and 8 deletions

View 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);

View 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);

View 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;

View 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

View file

@ -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);