From patchwork Fri Jun 23 13:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rick Kern X-Patchwork-Id: 4088 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp132165vsw; Fri, 23 Jun 2017 06:54:11 -0700 (PDT) X-Received: by 10.28.227.67 with SMTP id a64mr5508410wmh.116.1498226051729; Fri, 23 Jun 2017 06:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498226051; cv=none; d=google.com; s=arc-20160816; b=nurlH1tLFmUrIhi4NB/X2aROPWwTJPPp5cSVZsoEsTNZSclbNLIvwhsHDn/D6HsGFm cB+pSvj456SfvY5DSeSSt6gcZt2vpp0G+eHJ3byj+gjfsSCTkSQSQMVE2cOLMYeMyO5U oFhjLwEgGbRBVvdIcS4JuP8r2n5QZcIxs8Sgw9+HwTG8zjme3UKvs0o3iyBoMKOhW2uQ Q1TBbsRZ3B8fHORbvejsvStKsxg+6QwUe+WN4wG9HVfSHI0lEy4LfRn2IYt6T6ANOTPY drJsz+A3u3Qq4EvUFFtJr2bapr76PDzFeWgrWj8jMe8vCvYq4zi6eeL5KIjzgffpOstq Z0iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:to:message-id:date:mime-version:references :in-reply-to:from:dkim-signature:delivered-to :arc-authentication-results; bh=8+Rq32x0Vz5adif8HJioHomY75K+qu0OLh6+iBDbpPc=; b=IErqR3Fe71UyaZZJRlDd2iBIrFX5MTv9aqdrqt9i/6pngw28FytHoEAI+rLURsSIPV qwczOCQbfoqdeBbxTwMCdV8ffzonq4Cuoo6AHXNv8TkU0bxGlAvAK+YZ0eYK2OZuKQZb bFd8wFq1fiaBIzS+w5FVQkC133fiLKS7QCypEX9GYh2yCAYYrWr4jqtkbKmzvXtJT61/ bqKL8OT4BEnDiLouEH5ZGWgnplXBsuW+oD4QgcETS2BvWnBXaghdDXiX8kaNaHcJknGk HzsIDZRGn36afzWi5fZ4Zypp2zN0S0Lanb/mNwtYegIxkbPGK6LeiPeRbIzhljMVTG8J Bscw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=l53DGWQG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d187si4149486wmf.35.2017.06.23.06.54.09; Fri, 23 Jun 2017 06:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=l53DGWQG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8555E689F72; Fri, 23 Jun 2017 16:54:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f181.google.com (mail-qk0-f181.google.com [209.85.220.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8839D689E65 for ; Fri, 23 Jun 2017 16:54:00 +0300 (EEST) Received: by mail-qk0-f181.google.com with SMTP id d78so2441287qkb.1 for ; Fri, 23 Jun 2017 06:54:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to; bh=gh0Lb8cyr0n0nZdQntUNMNw6g9t9c/0v9YsgNGJvms8=; b=l53DGWQGDSHs2G6rymXGqt58XZB9/GSNaA+H34VWUeZBMsL+NM7U39umPnJZKc+8Ve dBmcLhlbmxljA4EwHO962sF42jk/eQ/rm8Ejs6kSW/2U7QB5Kje/YwwBamxB6hgpZ7wo iTl6waxruun3bl1gE4Bir2u23G9xQ9sXweJGK90PvwgJu6xi0HKNoeR/Kzr6aEWGJOsS iCD2ZzYh+y1GxKp1kaCG7gg6q3MkSNGraGqfD2faFHnFNDiRF6/WNceuim708qc0QBu/ aVSfpU+TSeZcpVsWz3DVs0vr/0cnhKqHjjUlZHpTEDoCEjZSQtuRksyRqfcT9VrwWLDy vr1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to; bh=gh0Lb8cyr0n0nZdQntUNMNw6g9t9c/0v9YsgNGJvms8=; b=k7xFSX6Pm8ZQPO1Kab9rSEjsgrkxobQt6rIfI4DL4JpISXw+Y4BdVYoCZLhU108y5Z EwkX/0zHaOyH+ZEpxPtHGLlIwv59wW2BCraRhgcMkoEtSGrizaCU4kLSf3baPsa3Iwsr ShWYDKF1wB3BRRROk16+riGvBYTymNGc4sMq6M2OxhNptDlxB2u/GodsO9TDIM+5y5p9 Pk7XwRbZLPhJYYwycXdA6ThyPFa3hGF8E6gkBM41ihys8EIMq/NBIdMeKkSUTpfEXQAl S1eN1nxWYsgRyPI7YQZG+rkuU0vXxlbbH67WKEBN8kK3HLwf3MmLI7MYT2CSfw3OPAdb 8D3w== X-Gm-Message-State: AKS2vOzfSI3pv0VVQ/YJLdvOIHa5qyRkO8sCm2AQrcRbL0tRj7uF1bKV 9HcjB5qq9kawyAQ/W7cdvO6jj4Sp8w== X-Received: by 10.55.212.199 with SMTP id s68mr9668231qks.88.1498225534186; Fri, 23 Jun 2017 06:45:34 -0700 (PDT) Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Fri, 23 Jun 2017 06:45:33 -0700 From: Richard Kern In-Reply-To: References: X-Mailer: Airmail (442) MIME-Version: 1.0 Date: Fri, 23 Jun 2017 06:45:33 -0700 Message-ID: To: Steven Liu , FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] videotoolboxenc.c crash on iOS8 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On June 17, 2017 at 6:46:58 PM, Steven Liu (lingjiujianke@gmail.com) wrote: 2017-06-17 11:17 GMT+08:00 姜 文杰 : > when use videotoolboxencoder in ffmpeg, some codes will lead to crash. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > From ee465de23b27cbeaaa25fd3d8abf57680394a284 Mon Sep 17 00:00:00 2001 From: jerett 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(-) static pthread_once_t once_ctrl = PTHREAD_ONCE_INIT; 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 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)