[vlc-commits] input: set the thread priority from the thread callback

Thomas Guillem git at videolan.org
Fri Mar 4 13:19:33 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar  4 13:14:34 2016 +0100| [4dd2f5c60ffd1047a36b7d5442d18404d980674b] | committer: Thomas Guillem

input: set the thread priority from the thread callback

input_Read() doesn't create any threads and run the Init() function that could
change the priority of an uninitialized thread.

This could happen when running ./vlc --sout from Windows.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4dd2f5c60ffd1047a36b7d5442d18404d980674b
---

 src/input/input.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 2f8088e..4a0caf4 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -479,6 +479,13 @@ static void *Run( void *obj )
 
     if( !Init( p_input ) )
     {
+        if( p_input->p->b_can_pace_control && p_input->p->b_out_pace_control )
+        {
+            /* We don't want a high input priority here or we'll
+             * end-up sucking up all the CPU time */
+            vlc_set_priority( p_input->p->thread, VLC_THREAD_PRIORITY_LOW );
+        }
+
         MainLoop( p_input, true ); /* FIXME it can be wrong (like with VLM) */
 
         /* Clean up */
@@ -1202,13 +1209,6 @@ static int Init( input_thread_t * p_input )
     {
         p_input->p->b_out_pace_control = (p_input->p->p_sout->i_out_pace_nocontrol > 0);
 
-        if( p_input->p->b_can_pace_control && p_input->p->b_out_pace_control )
-        {
-            /* We don't want a high input priority here or we'll
-             * end-up sucking up all the CPU time */
-            vlc_set_priority( p_input->p->thread, VLC_THREAD_PRIORITY_LOW );
-        }
-
         msg_Dbg( p_input, "starting in %s mode",
                  p_input->p->b_out_pace_control ? "async" : "sync" );
     }



More information about the vlc-commits mailing list