[vlc-devel] [PATCH 1/4] adaptive: fix crash when selector returns no suitable representation
Pierre Ynard
linkfanel at yahoo.fr
Sun Nov 8 01:04:56 CET 2020
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.
diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 9afdead..d31758b 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);
--
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