From 11074cb8258a9b995346d69baaafee50ba56393f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Sun, 4 Oct 2015 18:33:12 +0200
Subject: [PATCH] videotoolbox: fail early on unsupported iOS releases (closes
 #15085)

---
 modules/codec/videotoolbox.m | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 0a8aaeebfd3e..782d0f47c0da 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -42,6 +42,10 @@
 #import <sys/sysctl.h>
 #import <mach/machine.h>
 
+#if TARGET_OS_IPHONE
+#import <UIKit/UIKit.h>
+#endif
+
 #pragma mark - module descriptor
 
 static int OpenDecoder(vlc_object_t *);
@@ -629,9 +633,16 @@ static void StopVideoToolbox(decoder_t *p_dec)
 static int OpenDecoder(vlc_object_t *p_this)
 {
     decoder_t *p_dec = (decoder_t *)p_this;
-    CMVideoCodecType codec;
+
+#if TARGET_OS_IPHONE
+    if (unlikely([[UIDevice currentDevice].systemVersion floatValue] < 8.0)) {
+        msg_Warn(p_dec, "decoder skipped as OS is too old");
+        return VLC_EGENERIC;
+    }
+#endif
 
     /* check quickly if we can digest the offered data */
+    CMVideoCodecType codec;
     codec = CodecPrecheck(p_dec);
     if (codec == -1)
         return VLC_EGENERIC;
-- 
GitLab