From patchwork Fri Sep 30 05:48:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min X-Patchwork-Id: 787 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp51554vsd; Thu, 29 Sep 2016 23:04:03 -0700 (PDT) X-Received: by 10.194.150.115 with SMTP id uh19mr5572249wjb.57.1475215442923; Thu, 29 Sep 2016 23:04:02 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w6si3067714wmw.38.2016.09.29.23.04.00; Thu, 29 Sep 2016 23:04:02 -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; 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 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 7EB98689EB7; Fri, 30 Sep 2016 09:03:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D57D0689C90 for ; Fri, 30 Sep 2016 09:03:39 +0300 (EEST) Received: by mail-wm0-f66.google.com with SMTP id b184so1830584wma.3 for ; Thu, 29 Sep 2016 23:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=uQ5Jb/u7xx3d56suqML6hlZYIiVVN1h2dricyUNND3s=; b=On2Y4uW9ktiqQtFAJncfUmrFNPz48J/CqhxEx3S4OjZwkjvHEQsCQp76WsbUbqLPZ3 LPAxbpoIPGOtXzbWvebnuAoBapCAXtSyIi7S3qjIMvuF+G5ysnsJ5xEkNLqBH1RUNTel NxmT0dnEDdLD2jgJbkywt/CUbJ5GCo0VEAoYgcJ74C0zv7JHV5m/QvahbpuY9mQbbJkn KDkJUgk08142HS4bsNWm+UvnpAAOLylbOzhXJpY2uWxqnGqpVc8AAl1C4JqI5yM7EEOe dd/ipEiJByJFl0R+TBm0Afi/hULKMaaJBtT7xvTd16g5i1aisCU2a4zKjJVhJewdqNGJ U/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=uQ5Jb/u7xx3d56suqML6hlZYIiVVN1h2dricyUNND3s=; b=DjE+V1cA6Qw+OYWQTERF7Udtfkv/KBAfwIrEROUg5XdrdfHnSRA6Hm2d9VLlHBUDNM S9Byz2orzpLoHEnXh2YMr3KorpT2VlDi7ZIoWK67DfBy615M+I6NHKX7xjv0zXMm1OU1 g9ENkxIaG1QwyGwb31U3Sw4EWuv0wJGN2/jXGAxGMQu3M+28eW471aYPjl1pJ+mx41uh zHAkxvLOCJ6hsz1m20YctKGHGAxxpzXwq+YYQoZTV4Xb3u9uTBmo1Q15sh3OyS2ArddE bLfgI0nsK7b5YstQBSGirdRTlRDZiRcxSFuyaiSqxUcRaRqm/FEX2uBXwVvaNT2RLHCm WNcg== X-Gm-Message-State: AA6/9RkuRQh9GW0IQYf9UoRZWVtJOuCMq7Jtrmuaxwho/rXbTPjJ8PW7nBbfGmOCok5gkoj2Fv12PPt+4xymQw== X-Received: by 10.194.149.6 with SMTP id tw6mr4492505wjb.218.1475214504176; Thu, 29 Sep 2016 22:48:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.225.69 with HTTP; Thu, 29 Sep 2016 22:48:08 -0700 (PDT) From: Min Date: Fri, 30 Sep 2016 07:48:08 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [PATCH] DXVA2: Fix crash releasing IDirect3D9Surface's with av_buffer_default_free instead of Release 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" } return NULL; diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index e79254b..17d8eb5 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -101,6 +101,11 @@ static void dxva2_frames_uninit(AVHWFramesContext *ctx) } } +void dxva2_pool_free(void *opaque, uint8_t *data) +{ + // No need to free surfaces here, they will be Released later +} + static AVBufferRef *dxva2_pool_alloc(void *opaque, int size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; @@ -110,7 +115,7 @@ static AVBufferRef *dxva2_pool_alloc(void *opaque, int size) if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; return av_buffer_create((uint8_t*)s->surfaces_internal[s->nb_surfaces_used - 1], - sizeof(*hwctx->surfaces), NULL, 0, 0); + sizeof(*hwctx->surfaces), dxva2_pool_free, 0, 0);