[vlc-devel] keep new decoders deselected state

Francois Cartegnie fcvlcdev at free.fr
Wed May 16 22:31:54 CEST 2018


untested

---
 modules/demux/adaptive/plumbing/FakeESOut.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/plumbing/FakeESOut.cpp b/modules/demux/adaptive/plumbing/FakeESOut.cpp
index 73b39954b9..1e814b8f7c 100644
--- a/modules/demux/adaptive/plumbing/FakeESOut.cpp
+++ b/modules/demux/adaptive/plumbing/FakeESOut.cpp
@@ -119,6 +119,7 @@ void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
 
     vlc_mutex_lock(&lock);
 
+    bool b_preexisting = false;
     bool b_select = false;
     for( it=recycle_candidates.begin(); it!=recycle_candidates.end(); ++it )
     {
@@ -133,6 +134,7 @@ void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
         }
         else if( cand->getFmt()->i_cat == es_id->getFmt()->i_cat && cand->realESID() )
         {
+            b_preexisting = true;
             /* We need to enforce same selection when not reused
                Otherwise the es will select any other compatible track
                and will end this in a activate/select loop when reactivating a track */
@@ -144,8 +146,18 @@ void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
     if( !realid )
     {
         realid = es_out_Add( real_es_out, es_id->getFmt() );
-        if( b_select )
-            es_out_Control( real_es_out, ES_OUT_SET_ES, realid );
+        if( b_preexisting )
+        {
+            if( b_select ) /* was previously selected on other format */
+                es_out_Control( real_es_out, ES_OUT_SET_ES, realid );
+            else
+            {
+                /* ensure no auto selection */
+                es_out_Control( real_es_out, ES_OUT_GET_ES_STATE, realid, &b_select );
+                if( b_select ) /* was single es, now selected and != prev state */
+                    es_out_Control( real_es_out, ES_OUT_SET_ES_STATE, realid, false );
+            }
+        }
     }
 
     es_id->setRealESID( realid );
-- 
2.14.3



More information about the vlc-devel mailing list