]> git.sesse.net Git - vlc/commitdiff
On pause and rate change from normal rate, call input_EsOutDiscontinuity
authorLaurent Aimar <fenrir@videolan.org>
Fri, 2 Mar 2007 19:42:22 +0000 (19:42 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 2 Mar 2007 19:42:22 +0000 (19:42 +0000)
as soon as possible to allow decoders to flush (well that part need to
be implemented ;)

src/input/input.c
src/input/input_internal.h

index 9e438ad0474238df4562f2668df0a993eb8b80e2..8c3ab2de860b2c7f760ead200a2da460766c7e1f 100644 (file)
@@ -1549,7 +1549,6 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
 
                 /* Reset clock */
                 es_out_Control( p_input->p->p_es_out, ES_OUT_RESET_PCR );
-                input_EsOutDiscontinuity( p_input->p->p_es_out, VLC_FALSE );
             }
             else if( val.i_int == PAUSE_S && p_input->i_state == PLAYING_S &&
                      p_input->p->b_can_pause )
@@ -1577,6 +1576,10 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
                 /* Switch to new state */
                 p_input->i_state = val.i_int;
                 var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
+
+                /* Send discontinuity to decoders (it will allow them to flush
+                 * if implemented */
+                input_EsOutDiscontinuity( p_input->p->p_es_out, VLC_FALSE );
             }
             else if( val.i_int == PAUSE_S && !p_input->p->b_can_pause )
             {
@@ -1624,14 +1627,15 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
             }
             if( i_rate != p_input->p->i_rate )
             {
-                p_input->p->i_rate  = i_rate;
                 val.i_int = i_rate;
                 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
 
-                /* We haven't send data to decoder when rate != default */
-                if( i_rate == INPUT_RATE_DEFAULT )
+                /* We will not send audio data if new rate != default */
+                if( i_rate != INPUT_RATE_DEFAULT && p_input->p->i_rate == INPUT_RATE_DEFAULT )
                     input_EsOutDiscontinuity( p_input->p->p_es_out, VLC_TRUE );
 
+                p_input->p->i_rate  = i_rate;
+
                 /* Reset clock */
                 es_out_Control( p_input->p->p_es_out, ES_OUT_RESET_PCR );
 
index c3ac9ba449bdb8220cfb1c3c688c10d499133568..06bd80371ba205240bb26300de927485aa3ae3b2 100644 (file)
@@ -245,7 +245,7 @@ void stream_AccessDelete( stream_t *s );
 void stream_AccessReset( stream_t *s );
 void stream_AccessUpdate( stream_t *s );
 
-/* decoder.c FIXME make it public ?*/
+/* decoder.c */
 void       input_DecoderDiscontinuity( decoder_t * p_dec );
 vlc_bool_t input_DecoderEmpty( decoder_t * p_dec );
 void       input_DecoderPreroll( decoder_t *p_dec, int64_t i_preroll_end );