[vlc-devel] [PATCH] input: process start time seek before demux loop (fix #9063)

Francois Cartegnie fcvlcdev at free.fr
Thu Oct 19 10:40:13 CEST 2017


as controls are processed after first demux call, data is always
going to es_out / decoders / sout even if it's not wanted.
---
 src/input/input.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 1b22a6281e..505a17811f 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -696,6 +696,15 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
     demux_t *p_demux = input_priv(p_input)->master->p_demux;
     const bool b_can_demux = p_demux->pf_demux != NULL;
 
+    /* Process start seek offset */
+    if( input_priv(p_input)->i_start > 0 && !input_priv(p_input)->master->b_eof )
+    {
+        vlc_value_t val;
+        val.i_int = input_priv(p_input)->i_start;
+        Control( p_input, INPUT_CONTROL_SET_TIME, val );
+        /* TODO don't skip if time < es_out buffering */
+    }
+
     while( !input_Stopped( p_input ) && input_priv(p_input)->i_state != ERROR_S )
     {
         mtime_t i_wakeup = -1;
@@ -946,13 +955,8 @@ static void StartTitle( input_thread_t * p_input )
 
     if( priv->i_start > 0 )
     {
-        vlc_value_t s;
-
         msg_Dbg( p_input, "starting at time: %"PRId64"s",
                  priv->i_start / CLOCK_FREQ );
-
-        s.i_int = priv->i_start;
-        input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &s );
     }
     if( priv->i_stop > 0 && priv->i_stop <= priv->i_start )
     {
-- 
2.13.6



More information about the vlc-devel mailing list