[vlc-commits] adaptive: fix crash when selector returns no suitable representation
Pierre Ynard
git at videolan.org
Mon Nov 9 20:46:06 CET 2020
vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Nov 8 01:04:56 2020 +0100| [fe838abf186942e564e9943f35b00fc82f120daf] | 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>
(cherry picked from commit ccd7f295de88279770da6d8a8281b404c2b2f4ac)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=fe838abf186942e564e9943f35b00fc82f120daf
---
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 84b19bbe20..5d8227275e 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -89,8 +89,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