[vlc-commits] adaptive: fix crash when selector returns no suitable representation

Pierre Ynard via vlc-devel git at videolan.org
Mon Nov 9 10:22:03 CET 2020


vlc | branch: master | Pierre Ynard via vlc-devel <vlc-devel at videolan.org> | Sun Nov  8 01:04:56 2020 +0100| [41c169de7aa8468c8f168d06debd3d01c9ffaec5] | committer: Francois Cartegnie

adaptive: fix crash when selector returns no suitable representation

This happens in particular when requesting a resolution lower than
the lowest available one. It affects only the default, near optimal
adaptation logic; all other logics cope with this without crashing.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 9afdead977..d31758b49c 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -87,8 +87,13 @@ BaseRepresentation *NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
 {
     RepresentationSelector selector(maxwidth, maxheight);
 
-    const float umin = getUtility(selector.lowest(adaptSet));
-    const float umax = getUtility(selector.highest(adaptSet));
+    BaseRepresentation *lowest = selector.lowest(adaptSet);
+    BaseRepresentation *highest = selector.highest(adaptSet);
+    if(lowest == NULL || highest == NULL)
+        return NULL;
+
+    const float umin = getUtility(lowest);
+    const float umax = getUtility(highest);
 
     vlc_mutex_lock(&lock);
 



More information about the vlc-commits mailing list