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

Thomas Guillem git at videolan.org
Tue Jan 23 09:53:18 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 22 13:24:05 2018 +0100| [5ff52a41a8e62ee0e818676be066da83a53d8ef4] | committer: Thomas Guillem

es_out: unselect the main es before selecting a new one

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

Fixes #19206

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

 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,



More information about the vlc-commits mailing list