[vlc-commits] demux: adaptive: keep new decoders deselected state

Francois Cartegnie git at videolan.org
Fri May 18 17:09:46 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 16 22:29:29 2018 +0200| [5066a19f0a819c00e90a90e792397fc6a09eaa47] | committer: Francois Cartegnie

demux: adaptive: keep new decoders deselected state

refs #20436

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

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

diff --git a/modules/demux/adaptive/plumbing/FakeESOut.cpp b/modules/demux/adaptive/plumbing/FakeESOut.cpp
index 73b39954b9..017e857ed8 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 */
@@ -143,9 +145,16 @@ void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
 
     if( !realid )
     {
-        realid = es_out_Add( real_es_out, es_id->getFmt() );
-        if( b_select )
+        es_format_t fmt;
+        es_format_Copy( &fmt, es_id->getFmt() );
+        if( b_preexisting && !b_select ) /* was not previously selected on other format */
+            fmt.i_priority = ES_PRIORITY_NOT_DEFAULTABLE;
+        else
+            fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN;
+        realid = es_out_Add( real_es_out, &fmt );
+        if( b_preexisting && b_select ) /* was previously selected on other format */
             es_out_Control( real_es_out, ES_OUT_SET_ES, realid );
+        es_format_Clean( &fmt );
     }
 
     es_id->setRealESID( realid );



More information about the vlc-commits mailing list