From patchwork Sat Jun 17 22:46:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 4012 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp261216vsw; Sat, 17 Jun 2017 15:47:00 -0700 (PDT) X-Received: by 10.223.178.140 with SMTP id g12mr9009456wrd.158.1497739619962; Sat, 17 Jun 2017 15:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497739619; cv=none; d=google.com; s=arc-20160816; b=wzvq+tyANvTBijpCc3dyiNSXQUHVC+i5Bl69ut8cIZTzAZJX94ozX+wl+ZREoJzje3 fKNrPg2ICCEu0g4yLISfA/UIgS4mL3/YlE/FKigPmPasjqTPEveVc+zXPCF46qIiRwmA 5Dwo/whm2VrLXu4tevZ2ww5zc3OtbPqwNeFwIcuaZBezHr/GrKZ6PWWbEoQPtHGT369E 0HxkvA000MkoJEpTUcA8pRbWheNDXe0huWOnWnpN2+6icTZLiRBgU0ICFrQ7ubaTCLB5 2H5Gpqv7BFqgnEtvBd2IwRwS22GSmq8B4oR5CATKElEqBWzrPuWhL3E0LhyeKyjZ5ZNk Rosg== 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:from:references:in-reply-to :mime-version:dkim-signature:delivered-to:arc-authentication-results; bh=VsiFozE6u79JAQJfkakcq9cCID1Ks6q23rlAbaHIds8=; b=BIwzBiVCN6/XlS1eK2hVZUMXhJNH5dbJcwWz9njccnfv09OO1qzQgu1csrBS1TdUps EomzV/EpmmEoNFsQs82TwwLpHLYSvwyhW6uRLNS0hRVKvpEDWTeKfMT/jIPEoCa86RxL D++r238sdUO9PxUkF+HQ2m8Lgcec87+m8pJLWkJVzYsjYb2UjMZ9fSF90++q+v9AlYpX GKkg8sneTXcA4coIl5oMO54BYUYxQNkBWm0eb39qoOHtek+skb0ytnyEqLOFFIkpvn2r EKRa/Wtvca5qTTgqrKKdRMfNMazahUQvfQE4zG8ks6mwWO+4khtnbM3DD+KkMaO/dN1U Y1IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=FbXjzo30; 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 2si6739839wrk.174.2017.06.17.15.46.59; Sat, 17 Jun 2017 15:46:59 -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=FbXjzo30; 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 5B697689F88; Sun, 18 Jun 2017 01:46:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw0-f180.google.com (mail-yw0-f180.google.com [209.85.161.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C19C66899D2 for ; Sun, 18 Jun 2017 01:46:45 +0300 (EEST) Received: by mail-yw0-f180.google.com with SMTP id e142so30395907ywa.1 for ; Sat, 17 Jun 2017 15:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=//13qCqC1x1vi5M5sDf9QqPr5MX0apHL87bgptv4ra0=; b=FbXjzo30xXPX9Fr2TUt5mJS6oEkoCjR0r/ggtiCKW8J3MplvmDOP7Okh9rONs2+moE l2o2feq4Ljx4UAWe7CFS+15bSbDcuRDqTacXhqCrooPYBg8/HXgFDfOmwz6YLMb6oi34 06uF6ApFlrlVzKACpubrMMtG6rWdqTn2e374xNJisj7243hauZKL6aVuxG6EK3YsGtPJ E2ocM4vARkiZZQau9oHXutx97s098OaWadxwQUO7/CYNV+i/t9mM7lSC5VSa9nxNP93q Wus0woxIYRBymlNuq89X646mnL/ZkXkuuuSmF5cx5RViw2TSI25Y7m+b79Cuv1THdK7o En+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=//13qCqC1x1vi5M5sDf9QqPr5MX0apHL87bgptv4ra0=; b=Pp+sxcwVRWqrgfVi4D9AQLKvEzJrNZTPUWfJ0/jTJliyoueYVwI5kXqUx93U01lOfv jlUA7K1KMtTOEZopRctjjPXUDz7/PPWk7attRSoOGqv0EDD1UObhRtC9Ke1hcOWDrINn GFP8RJG9hWkx+kPkqzrzdsOowlDO+oIFuI9IqrDvLkL9MS9nO+EZBODO9clxYFivJI/y dYFw8hqYVNGONt9z3DMawCErifAgk8sDwnEobxFM2n2EyDK+bVsNWMYQ3lJwY7wUEFyk 4CmCZyWryHyytpMWbvXdmAaEGJuE3u5HyolbofxIYOt1L+l2J7eBcHY8uEepAgWSknbZ JMKQ== X-Gm-Message-State: AKS2vOyunHlCboeFFSod4EGboqJBiMsoiQ1ldwd3vO+C2BWx1kxiHwU6 8x/R1SHSzdYNQjfgO+835Hw3EVYC9/dP X-Received: by 10.13.203.136 with SMTP id n130mr13064066ywd.131.1497739608257; Sat, 17 Jun 2017 15:46:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.53.79 with HTTP; Sat, 17 Jun 2017 15:46:47 -0700 (PDT) In-Reply-To: References: From: Steven Liu Date: Sun, 18 Jun 2017 06:46:47 +0800 Message-ID: To: FFmpeg development discussions and patches 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" 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)