From patchwork Sat Nov 11 12:16:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 5914 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp60050jah; Sat, 11 Nov 2017 04:16:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMZMN7ekkWLIx3QluQCxanXDo/70hfa2y0V1c0VSDpQp8uODa1jw6As2gnesnL0/l9mC0mGw X-Received: by 10.223.169.135 with SMTP id b7mr2662273wrd.171.1510402588383; Sat, 11 Nov 2017 04:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510402588; cv=none; d=google.com; s=arc-20160816; b=r9ycLAoNAUXNqK8fPk3rcayGBun/rp8boUScL19pMMmHNnxnPYu3fAIIWK4oLnzZrX hAOpl5zHxbOaFR1PDyn8g+Ty6khUJTv8zfgIxk80eYyNXlO/LDG292h41BcFM1v2I5no lIlYEVkgogja3DdwmCgUyrWDbBe0azI91kRNy4rUPnHXRQHE6KBwRwDVtsXr13gZscjG rvfLKkOSgrqLITNAn1z9rMDoUuAZo8xp3ER4rLd3gRsqq+qxeCLQWNnR0B6MzDVX4i43 dszm224vHkEQMbofv+/vhV2Ao0NBwYlCa1r5AOHu68tXzz+H5pdaEIxGdVyvEuV+7dCp ggNw== 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:dkim-signature:delivered-to:arc-authentication-results; bh=XE+BCXL7eKxwfk1n4NVpl5802iR052Ekw25Y187GG70=; b=cN8a0epYZCMRdt8f2n+sWgFZ+LW2D80vkjZeGFOtI7vIfelhjS0cm4RUPupypmavNM IZf5gvcrsRQ7q8S9pRruaMd3RAp8WvRnifzHtsLalNW852OGOdC3gIMrHInC6Sx3euYv 2ELa1zY3LB/XkHw5XQN8r9bAoUSK2qgs00zdY+Vgwk3gRykjii4cRFOaWHz2dhZpzDFu kMH54DTtndv7DIa1FgacoE/JwqIFGiEPUAQtDU0W3kl49WAyCJzEZrQNZdEd8WDXAE+T WSKzxjG2x2cDstQ+EEXZUR4QsPKhqSYyqCy9jOo/AA7qBXGo8JFedpBl6sViCJ1etKpg ZIyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=pJFoOUaF; 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 d66si1224355wmf.79.2017.11.11.04.16.28; Sat, 11 Nov 2017 04:16:28 -0800 (PST) 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=@rothenpieler.org header.s=mail header.b=pJFoOUaF; 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 3798768A043; Sat, 11 Nov 2017 14:16:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E037F6882A3 for ; Sat, 11 Nov 2017 14:15:58 +0200 (EET) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 8A2AC4BFB5; Sat, 11 Nov 2017 13:16:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1510402572; bh=t36RePFirwv64NKEmgzD53ERpk94olSF4PyXMxFYbpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pJFoOUaFy1wzmVUef1eu+/q5tea6FrqouhKWLc5X1L0DRt33uSZjh/7VjZaqiIp26 xi6HID/Z+hpxWt0WiN9HegizDcOwCb0amr+8utFjwayFDwiCh67fGTaWwXfa+Q1/LV dCpKbiwnBrvIXwj3y451rvojGXNpkKKbJuxDaBX4= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Nov 2017 13:16:06 +0100 Message-Id: <20171111121606.3901-2-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171111121606.3901-1-timo@rothenpieler.org> References: <20171111121606.3901-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 2/2] wmavoice: free frame before ff_get_buffer 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: michael@niedermayer.cc, Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" synth_superframe can be called twice per call to decode_packet. It is not fully clear if calling ff_get_buffer on the same frame twice is supported, so unref the frame first to be save. --- libavcodec/wmavoice.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 2ec4499981..3f86d0da35 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1756,6 +1756,10 @@ static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, stabilize_lsps(lsps[n], s->lsps); } + /* synth_superframe can run multiple times per packet + * free potential previous frame */ + av_frame_unref(frame); + /* get output buffer */ frame->nb_samples = MAX_SFRAMESIZE; if ((res = ff_get_buffer(ctx, frame, 0)) < 0)