[FFmpeg-devel] videotoolboxenc.c crash on iOS8
    Steven Liu 
    lingjiujianke at gmail.com
       
    Sun Jun 18 01:46:47 EEST 2017
    
    
  
2017-06-17 11:17 GMT+08:00 姜 文杰 <wj.jiang at outlook.com>:
>     when use videotoolboxencoder in ffmpeg,  some codes  will lead to crash.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>From ee465de23b27cbeaaa25fd3d8abf57680394a284 Mon Sep 17 00:00:00 2001
From: jerett <wj.jiang at outlook.com>
Date: Mon, 16 Jan 2017 16:44:11 +0800
Subject: [PATCH 1/2] fix open videotoolbox bug on iOS8.4
---
 libavcodec/videotoolboxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index cb9e2fe6e8..dbc9031384 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1137,7 +1137,7 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
                                    kCFAllocatorDefault,
                                    &has_b_frames_cfbool);
-    if (!status) {
+    if (!status && has_b_frames_cfbool) {
         //Some devices don't output B-frames for main profile, even
if requested.
         vtctx->has_b_frames = CFBooleanGetValue(has_b_frames_cfbool);
         CFRelease(has_b_frames_cfbool);
-- 
2.11.0 (Apple Git-81)
>From 8eaab291bee268b0ae7fe4ed7795b2af4c55a275 Mon Sep 17 00:00:00 2001
From: jerett <wj.jiang at outlook.com>
Date: Sat, 17 Jun 2017 10:22:58 +0800
Subject: [PATCH 2/2] fix loadVTEncSymbols crash when symbol not found
---
 libavcodec/videotoolboxenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 37c7957394..96c5648818 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -73,11 +73,11 @@ static struct{
 #define GET_SYM(symbol, defaultVal)                                     \
 do{                                                                     \
-    CFStringRef cfstr = *(CFStringRef*)dlsym(RTLD_DEFAULT, #symbol);    \
-    if(!cfstr)                                                          \
+    CFStringRef* handle = (CFStringRef*)dlsym(RTLD_DEFAULT, #symbol);
  \
+    if(!handle)                                                         \
         compat_keys.symbol = CFSTR(defaultVal);                         \
     else                                                                \
-        compat_keys.symbol = cfstr;                                     \
+        compat_keys.symbol = *handle;                                   \
 }while(0)
 static pthread_once_t once_ctrl = PTHREAD_ONCE_INIT;
-- 
2.11.0 (Apple Git-81)
there are two patch, you should send two patch.
    
    
More information about the ffmpeg-devel
mailing list