From patchwork Sun Nov 25 19:16:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 11155 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C789444C658 for ; Sun, 25 Nov 2018 21:16:32 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A18868A0E1; Sun, 25 Nov 2018 21:16:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5859B688338 for ; Sun, 25 Nov 2018 21:16:27 +0200 (EET) Received: by mail-wm1-f68.google.com with SMTP id y185so11038415wmd.1 for ; Sun, 25 Nov 2018 11:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=YK7zWnoDc/bwR5D0liJZBcFzxcmWaN6YbTjE4xkFvkw=; b=MzKKT5IGB4ihrz8tSLt0PAe03ZEjbNv1BIhnfWfp5nbnqimiSb8M8EFerkiTP4oPa6 7KU1mxSDq5FgfnH5pfpyYiof3JitMCMT9CnQQ0TWU1bgROX0CX1q35RCp+HR9V7xkZmc zr9ycvliMNOck0BlPC0aIpDVMd238XYGzKjOcHUeM95tB1SFLnGf3KbQKtdHmExg1a90 +MsCLlnN7BojJea/sdXE2x2Fm4xfi0DKOIB0TFgcsaF3UqOyQD931INv4zffsTfs0FYj nXO1gO6L/rYvAqVXHwLTfgCsLz8g2mVm5kTig9hcSovCtNsQ3cAbE6eOjjf8MPq0co9r 0rog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=YK7zWnoDc/bwR5D0liJZBcFzxcmWaN6YbTjE4xkFvkw=; b=uBiTBHwLrgBX7cJED3/5IXBXyXtLEGtyPLIVcBZAPhTg7dvUO2xZZDWdZ7hcSB13uB RxXmQdfLghP48vJA9Hzvn5y5Pjfm0ezrMfOp3HbtjyWI4tTzq/X9XjGQkAPos1p21ERt LNPaXXdRQ0yEYVGsj5tcNvwOmGT1zmcNkM2JdScNocvHndEMpUFjgoEg2/0z+e43rit5 CUUbLzdOC9GT0ClKsV1ewE+ISa1STpko8AEaTU+MQifUnISne9KIG3KUI1sNxA3MwTXt ZFFu7z498JvLZg5gkF/wzrKyfIKWl74tIv1Hx1k6/2q63+ACOyNgoJ9h3ewpt0MskYaW ljPw== X-Gm-Message-State: AA+aEWaL46GMBepOHoWass1t2tUtSZD3NW62E7I9a6ql9ZuJVj+7OLTr CWItXjIuHNm/nYs7lH3v0+SFeT2XTfc= X-Google-Smtp-Source: AFSGD/Um2VgUQ3H2jCmPaY1VDrSXy/5wCYrMi98jTpBLo6QZrCDwekIbyrUqX5anDcufetxXjHkE/w== X-Received: by 2002:a1c:c7cd:: with SMTP id x196mr12666338wmf.12.1543173390408; Sun, 25 Nov 2018 11:16:30 -0800 (PST) Received: from [192.168.0.4] (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id s139sm16284133wmd.3.2018.11.25.11.16.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 11:16:29 -0800 (PST) To: FFmpeg development discussions and patches From: Mark Thompson Message-ID: Date: Sun, 25 Nov 2018 19:16:25 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] hwcontext_opencl: Only release command queue if it exists 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" If the frames context creation fails then the command queue reference need not exist when uninit is called. --- libavutil/hwcontext_opencl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index c745b91775..e6cef74269 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -1750,10 +1750,13 @@ static void opencl_frames_uninit(AVHWFramesContext *hwfc) av_freep(&priv->mapped_frames); #endif - cle = clReleaseCommandQueue(priv->command_queue); - if (cle != CL_SUCCESS) { - av_log(hwfc, AV_LOG_ERROR, "Failed to release frame " - "command queue: %d.\n", cle); + if (priv->command_queue) { + cle = clReleaseCommandQueue(priv->command_queue); + if (cle != CL_SUCCESS) { + av_log(hwfc, AV_LOG_ERROR, "Failed to release frame " + "command queue: %d.\n", cle); + } + priv->command_queue = NULL; } }