[vlc-devel] [PATCH 4/4] adaptive: honor --preferred-resolution

Pierre Ynard linkfanel at yahoo.fr
Sun Nov 8 01:15:01 CET 2020


--adaptive-maxheight still takes precedence if set.

Fixes #21828


diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 0e7b62a..164ba09 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -847,8 +847,19 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
 
     if(logic)
     {
-        logic->setMaxDeviceResolution( var_InheritInteger(p_demux, "adaptive-maxwidth"),
-                                       var_InheritInteger(p_demux, "adaptive-maxheight") );
+        int w = var_InheritInteger(p_demux, "adaptive-maxwidth");
+        int h = var_InheritInteger(p_demux, "adaptive-maxheight");
+        if(h == 0)
+        {
+            h = var_InheritInteger(p_demux, "preferred-resolution");
+            /* Adapt for slightly different minimum/maximum semantics */
+            if(h == -1)
+                h = 0;
+            else if(h == 0)
+                h = 1;
+        }
+
+        logic->setMaxDeviceResolution(w, h);
     }
 
     return logic;
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list