From patchwork Tue May 28 06:56:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Wang X-Patchwork-Id: 13313 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 734634488FD for ; Tue, 28 May 2019 09:57:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 535D8689D2F; Tue, 28 May 2019 09:57:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DDE3668034E for ; Tue, 28 May 2019 09:57:10 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2019 23:57:08 -0700 X-ExtLoop1: 1 Received: from wr340g+.sh.intel.com (HELO localhost.localdomain) ([10.239.76.129]) by fmsmga008.fm.intel.com with ESMTP; 27 May 2019 23:57:07 -0700 From: Yan Wang To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 May 2019 14:56:18 +0800 Message-Id: <20190528065618.30579-1-yan.wang@linux.intel.com> X-Mailer: git-send-email 2.17.2 Subject: [FFmpeg-devel] [PATCH] libavcodec/vp9: Fix VP9 dynamic resolution changing decoding on VAAPI. 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 Cc: Yan Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When the format change, the VAAPI context cannot be destroyed. Otherwise, the reference frame surface will lost. Signed-off-by: Yan Wang --- libavcodec/decode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6c31166ec2..3eda1dc42c 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1397,7 +1397,9 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) for (;;) { // Remove the previous hwaccel, if there was one. +#if !CONFIG_VP9_VAAPI_HWACCEL hwaccel_uninit(avctx); +#endif user_choice = avctx->get_format(avctx, choices); if (user_choice == AV_PIX_FMT_NONE) { @@ -1479,7 +1481,11 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) "missing configuration.\n", desc->name); goto try_again; } +#if CONFIG_VP9_VAAPI_HWACCEL + if (hw_config->hwaccel && !avctx->hwaccel) { +#else if (hw_config->hwaccel) { +#endif av_log(avctx, AV_LOG_DEBUG, "Format %s requires hwaccel " "initialisation.\n", desc->name); err = hwaccel_init(avctx, hw_config);