[vlc-commits] access: dvb: scan: set probing timeout per delivery
Francois Cartegnie
git at videolan.org
Wed Apr 13 20:35:36 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 13 14:18:48 2016 +0200| [32a0446677b8548a37fa50cc7d7d50eb5f00b49b] | committer: Francois Cartegnie
access: dvb: scan: set probing timeout per delivery
does not wait for lock and starts probing timeout
when packets are received.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=32a0446677b8548a37fa50cc7d7d50eb5f00b49b
---
modules/access/dvb/access.c | 23 ++++++++++++++++-------
modules/access/dvb/scan.c | 24 ++++++++++++++++++++++++
modules/access/dvb/scan.h | 2 +-
3 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index df1f0ab..2114895 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -262,6 +262,7 @@ static block_t *BlockScan( access_t *p_access )
/* */
int64_t i_scan_start = mdate();
+ int64_t i_probe_start = 0;
bool b_has_dvb_signal = false;
bool b_has_lock = false;
@@ -278,18 +279,23 @@ static block_t *BlockScan( access_t *p_access )
for ( ; ; )
{
frontend_status_t status;
-
FrontendGetStatus( p_access, &status );
b_has_dvb_signal |= status.b_has_carrier;
b_has_lock |= status.b_has_lock;
- int64_t i_scan_end = i_scan_start;
- if( !b_has_dvb_signal )
- i_scan_end += DVB_SCAN_MAX_SIGNAL_TIME;
- else if( !b_has_lock )
- i_scan_end += DVB_SCAN_MAX_LOCK_TIME;
+ int64_t i_scan_end;
+ if( i_probe_start )
+ {
+ i_scan_end = i_probe_start + scan_session_GetTablesTimeout( session );
+ }
else
- i_scan_end += DVB_SCAN_MAX_PROBE_TIME;
+ {
+ i_scan_end = i_scan_start;
+ if( !b_has_dvb_signal )
+ i_scan_end += DVB_SCAN_MAX_SIGNAL_TIME;
+ else if( !b_has_lock )
+ i_scan_end += DVB_SCAN_MAX_LOCK_TIME;
+ }
/* Find if some data is available */
int i_ret;
@@ -344,6 +350,9 @@ static block_t *BlockScan( access_t *p_access )
if ( ufds[0].revents )
{
+ if( i_probe_start == 0 )
+ i_probe_start = mdate();
+
const int i_read_once = 1;
block_t *p_block = block_Alloc( i_read_once * TS_PACKET_SIZE );
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index d13cbec..db3a3c9 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -126,6 +126,7 @@ struct scan_session_t
size_t i_nit;
} others;
+ scan_type_t type;
bool b_use_nit;
uint16_t i_nit_pid;
@@ -1155,6 +1156,7 @@ scan_session_t *scan_session_New( scan_t *p_scan, const scan_tuner_config_t *p_c
p_session->local.p_nit = NULL;
p_session->i_nit_pid = -1;
p_session->b_use_nit = p_scan->parameter.b_use_nit;
+ p_session->type = p_scan->parameter.type;
p_session->others.i_nit = 0;
p_session->others.i_sdt = 0;
p_session->others.pp_nit = NULL;
@@ -1464,3 +1466,25 @@ void scan_session_SetSNR( scan_session_t *p_session, int i_snr )
{
p_session->i_snr = i_snr;
}
+
+unsigned scan_session_GetTablesTimeout( const scan_session_t *p_session )
+{
+ unsigned i_time = 0;
+ if( !p_session->local.p_pat )
+ {
+ i_time = 500;
+ }
+ else if( !p_session->local.p_sdt )
+ {
+ i_time = 2*1000;
+ }
+ else if( !p_session->local.p_nit && p_session->b_use_nit )
+ {
+ if( p_session->type == SCAN_DVB_T )
+ i_time = 6000;
+ else
+ i_time = 5000;
+ }
+
+ return i_time * 2 * 1000;
+}
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 26d0338..6b4a306 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -92,4 +92,4 @@ scan_session_t *scan_session_New( scan_t *, const scan_tuner_config_t * );
void scan_session_Destroy( scan_t *, scan_session_t * );
bool scan_session_Push( scan_session_t *p_scan, block_t *p_block );
void scan_session_SetSNR( scan_session_t *p_scan, int i_snr );
-
+unsigned scan_session_GetTablesTimeout( const scan_session_t * );
More information about the vlc-commits
mailing list