Skip to content

Commit

Permalink
dvb: scan: better check raw scan nit presence
Browse files Browse the repository at this point in the history
  • Loading branch information
fcartegnie committed May 16, 2016
1 parent 12ae9e0 commit 1659ee6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions modules/access/dvb/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct scan_t

size_t i_multiplex;
scan_multiplex_t **pp_multiplex;
bool b_multiplexes_from_nit;

scan_list_entry_t *p_scanlist;
size_t i_scanlist;
Expand Down Expand Up @@ -408,6 +409,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter,
p_scan->i_multiplex = 0;
p_scan->pp_multiplex = NULL;
p_scan->i_multiplex_toscan = 0;
p_scan->b_multiplexes_from_nit = false;
scan_parameter_Init( &p_scan->parameter );
scan_parameter_Copy( p_parameter, &p_scan->parameter );
p_scan->i_time_start = mdate();
Expand Down Expand Up @@ -776,10 +778,8 @@ static int Scan_GetNextTunerConfig( scan_t *p_scan, scan_tuner_config_t *p_cfg,
}

if( p_scan->p_scanlist == NULL &&
/* Stop frequency scanning if we found a NIT */
( p_scan->i_multiplex == 0 ||
p_scan->pp_multiplex[0]->i_nit_version == UINT8_MAX )
)
( p_scan->i_multiplex == 0 || /* Stop frequency scanning if we've found a valid NIT */
(p_scan->parameter.b_use_nit && !p_scan->b_multiplexes_from_nit) ) )
{
int i_ret = Scan_GetNextSpectrumTunerConfig( p_scan, p_cfg, pf_pos );
if( i_ret == VLC_SUCCESS )
Expand Down Expand Up @@ -1278,8 +1278,14 @@ static void ParseNIT( vlc_object_t *p_obj, scan_t *p_scan,
}
}

bool b_valid = scan_tuner_config_StandardValidate( &tscfg );
if( b_valid && p_nit->i_table_id == NIT_CURRENT_NETWORK_TABLE_ID )
{
p_scan->b_multiplexes_from_nit |= b_valid;
}

scan_multiplex_t *p_mplex = scan_FindMultiplex( p_scan, p_ts->i_ts_id );
if( p_mplex == NULL && scan_tuner_config_StandardValidate( &tscfg ) )
if( p_mplex == NULL && b_valid )
{
p_mplex = scan_multiplex_New( &tscfg, p_ts->i_ts_id );
if( likely(p_mplex) )
Expand Down

0 comments on commit 1659ee6

Please sign in to comment.