Commit 3756098a authored by Laurent Aimar's avatar Laurent Aimar

Let the value from --rate use the same code path than a value set at runtime.

It closes #4861.
It fixes playback when the rate cannot be respected (like with dvb/udp/...)
or need to be requested to the access_demux (rtsp).
parent c0b09202
......@@ -370,13 +370,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input->p->title = NULL;
p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
p_input->p->i_state = INIT_S;
double f_rate = var_InheritFloat( p_input, "rate" );
if( f_rate <= 0. )
{
msg_Warn( p_input, "Negative or zero rate values are forbidden" );
f_rate = 1.;
}
p_input->p->i_rate = INPUT_RATE_DEFAULT / f_rate;
p_input->p->i_rate = INPUT_RATE_DEFAULT;
p_input->p->b_recording = false;
memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) );
TAB_INIT( p_input->p->i_bookmark, p_input->p->pp_bookmark );
......@@ -1290,6 +1284,13 @@ static int Init( input_thread_t * p_input )
LoadSubtitles( p_input );
LoadSlaves( p_input );
InitPrograms( p_input );
double f_rate = var_InheritFloat( p_input, "rate" );
if( f_rate != 0.0 && f_rate != 1.0 )
{
vlc_value_t val = { .i_int = INPUT_RATE_DEFAULT / f_rate };
input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &val );
}
}
if( !p_input->b_preparsing && p_input->p->p_sout )
......
......@@ -137,8 +137,6 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* Rate */
var_Create( p_input, "rate", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
val.f_float = (float)INPUT_RATE_DEFAULT / (float)p_input->p->i_rate;
var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "frame-next", VLC_VAR_VOID );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment