From patchwork Wed Mar 21 07:43:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruiling Song X-Patchwork-Id: 8067 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp4825949jad; Wed, 21 Mar 2018 00:43:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELvpyLLRLB3UkjnNPXFwTbs5dNJ1KrKhkSG7QS1cyiL2bp2DQHgBWkbRV6XYDggMk5xJpsFi X-Received: by 10.223.133.197 with SMTP id 5mr14846977wru.130.1521618239186; Wed, 21 Mar 2018 00:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521618239; cv=none; d=google.com; s=arc-20160816; b=CayJcwWgCtH5namNpejIKIfiQI3x6FnZ3t6RYN5Hr0L6onX7PplfTbTYb1bBKKlcGq s4uLQbEX2YEW0V0wG6GYdOHyXDu7EADTDkEknPT3rYGfvZk9hzTNxaqPgFMOIEdj/Zq+ Q4RYdcoSPvhSKgSy9UaN9KDRrRjO8wHF1RcEEj2Jp41x7BDFa/zy3Ed0ZqS0xBD3mLh/ F5zoKPpjdPukYAuKSkLKY3rT98kfuzCUr38uKDK7UcFtY1So5DzCu4Wvk6vooO1XKk40 R49kg3UyocUFtAMmgY1LxFvnucDPvrAFjrBAnMiDpsZCdS7wG4GZJqYnMxgw8BlSliKd UITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=Rgphe9thSo2tudlXu9O34FHk9VpIKchftmzwMeZdHIk=; b=LCTLDFM6FxMxi07qlGiNlPnYqRyJSVmyPD1hu0AHodi6JTPjE7S6kI7WFPwmlWLwme E9PO8YLcSNbYFqONoyd5QaCZfvUYa3vg/N7rxvNZfEyQP7QyhScnWln2v6up6mtdFqeO eqw/hsRrHwgx5gRP50H+rUovd9EMiDA4eBBq6pOcFjZCLV25RumwdCoIc50PT6+MWBQb uf4j6LV5nHF0KHS+TBPuHCJK+Hg3TjrQV+apJ1uuByO4B16EQe3QaJzrEGSwevLg/jBF 593xok7tY2SMn7QnjtzkKf7Y0v/9lbjBhqc1B/irWzAB02UQ5oYoJ7CQaQ4B4neg2oJr qKxw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q50si2853743wrb.536.2018.03.21.00.43.58; Wed, 21 Mar 2018 00:43: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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 620EE689ABD; Wed, 21 Mar 2018 09:43:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D249689A79 for ; Wed, 21 Mar 2018 09:43:26 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 00:43:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,339,1517904000"; d="scan'208";a="213271440" Received: from ruiling-skl2.sh.intel.com ([10.239.160.43]) by fmsmga006.fm.intel.com with ESMTP; 21 Mar 2018 00:43:37 -0700 From: Ruiling Song To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Mar 2018 15:43:18 +0800 Message-Id: <1521618198-4618-2-git-send-email-ruiling.song@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521618198-4618-1-git-send-email-ruiling.song@intel.com> References: <1521618198-4618-1-git-send-email-ruiling.song@intel.com> Subject: [FFmpeg-devel] [PATCH 2/2] lavf: clone the frame managed by framework. 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: Ruiling Song MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" we should clone the frame, which is managed by the framework. directly assign it will cause double-free issue when qsv try to free it. In fact, the frames was managed by the framework! Right now, I am still not quite sure why we receive 'more data' error from libmfx. But some simple debugging seems that it is non-sense. so just skip it totally, not bothering to return a EAGAIN error to the caller. Signed-off-by: Ruiling Song --- libavfilter/qsvvpp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index f32b46d..980dd62 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -296,7 +296,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p av_log(ctx, AV_LOG_ERROR, "QSVVPP gets a wrong frame.\n"); return NULL; } - qsv_frame->frame = picref; + qsv_frame->frame = av_frame_clone(picref); qsv_frame->surface = (mfxFrameSurface1 *)qsv_frame->frame->data[3]; } else { /* make a copy if the input is not padded as libmfx requires */ @@ -318,7 +318,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p av_frame_copy_props(qsv_frame->frame, picref); av_frame_free(&picref); } else - qsv_frame->frame = picref; + qsv_frame->frame = av_frame_clone(picref); if (map_frame_to_surface(qsv_frame->frame, &qsv_frame->surface_internal) < 0) { @@ -707,7 +707,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) { /* Ignore more_data error */ if (ret == MFX_ERR_MORE_DATA) - ret = AVERROR(EAGAIN); + ret = 0; break; }