[vlc-devel] [PATCH] es_out: unselect the main es before selecting a new one

Thomas Guillem thomas at gllm.fr
Mon Jan 22 15:01:44 CET 2018


This avoids having more than one decoder per es and maybe more than one
aout/vout at the same time.

Fixes #19206
---
 src/input/es_out.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index e5c43868a5..61e92055f8 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1864,10 +1864,19 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
         return;
     }
 
+    bool b_auto_unselect = p_esprops && p_sys->i_mode == ES_OUT_MODE_AUTO &&
+                           p_esprops->e_policy == ES_OUT_ES_POLICY_EXCLUSIVE &&
+                           p_esprops->p_main_es && p_esprops->p_main_es != es;
+
     if( p_sys->i_mode == ES_OUT_MODE_ALL || b_force )
     {
         if( !EsIsSelected( es ) )
+        {
+            if( b_auto_unselect )
+                EsUnselect( out, p_esprops->p_main_es, false );
+
             EsSelect( out, es );
+        }
     }
     else if( p_sys->i_mode == ES_OUT_MODE_PARTIAL )
     {
@@ -1968,23 +1977,17 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
         }
 
         if( wanted_es == es && !EsIsSelected( es ) )
-            EsSelect( out, es );
-    }
-
-    /* FIXME TODO handle priority here */
-    if( p_esprops && EsIsSelected( es ) )
-    {
-        if( p_sys->i_mode == ES_OUT_MODE_AUTO )
         {
-            if( p_esprops->e_policy == ES_OUT_ES_POLICY_EXCLUSIVE &&
-                p_esprops->p_main_es &&
-                p_esprops->p_main_es != es )
-            {
+            if( b_auto_unselect )
                 EsUnselect( out, p_esprops->p_main_es, false );
-            }
-            p_esprops->p_main_es = es;
+
+            EsSelect( out, es );
         }
     }
+
+    /* FIXME TODO handle priority here */
+    if( p_esprops && p_sys->i_mode == ES_OUT_MODE_AUTO && EsIsSelected( es ) )
+        p_esprops->p_main_es = es;
 }
 
 static void EsOutCreateCCChannels( es_out_t *out, vlc_fourcc_t codec, uint64_t i_bitmap,
-- 
2.11.0



More information about the vlc-devel mailing list