]> git.sesse.net Git - vlc/commitdiff
input: tickless pause
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Feb 2015 16:14:39 +0000 (18:14 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Feb 2015 18:38:43 +0000 (20:38 +0200)
Now we no longer update times and statistics in the control loop
(where it was kinda pointless). If there is no wake-up from the ES
output, then the input thread only needs to wait for control requests
- which means it can sleep without time-out.

In practice, that corresponds to the input thread being paused and
not buffering (buffering while paused is possible due to seek).

src/input/input.c

index 36d3b6d2d0cfd2126cf92c2c53d08a310d4629c9..9f66169662e065f35e5110203aee578df95c6156 100644 (file)
@@ -684,7 +684,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
     while( vlc_object_alive( p_input ) && !p_input->b_error )
     {
-        mtime_t i_wakeup = 0;
+        mtime_t i_wakeup = -1;
         bool b_demux_polled = true;
         bool b_paused = p_input->p->i_state == PAUSE_S;
         /* FIXME if p_input->p->i_state == PAUSE_S the access/access_demux
@@ -743,10 +743,6 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
         {
             mtime_t i_deadline = i_wakeup;
 
-            if( b_paused || !b_demux_polled )
-                /* FIXME: remove this polling */
-                i_deadline = mdate() + INT64_C(250000);
-
             /* Postpone seeking until ES buffering is complete or at most
              * 125 ms. */
             bool b_postpone = es_out_GetBuffering( p_input->p->p_es_out )
@@ -757,7 +753,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
                 /* Recheck ES buffer level every 20 ms when seeking */
                 if( now < i_last_seek_mdate + INT64_C(125000)
-                 && i_deadline > now + INT64_C(20000) )
+                 && (i_deadline < 0 || i_deadline > now + INT64_C(20000)) )
                     i_deadline = now + INT64_C(20000);
                 else
                     b_postpone = false;