From patchwork Wed Sep 12 18:14:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 10306 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp5107506jap; Wed, 12 Sep 2018 11:15:05 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda1db4vhg0fuFXC8Z7rtNVIS2zCAFqTZa3Y8wJhVqxFfmjY8FLBSHzHF8Mxg7Y6z2wIOj2T X-Received: by 2002:adf:f4ce:: with SMTP id h14-v6mr2660450wrp.259.1536776105895; Wed, 12 Sep 2018 11:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536776105; cv=none; d=google.com; s=arc-20160816; b=B7OLSpkHjWFzkDhqFemwU2NtkK8Ey0c8Yh/XB6hunZEEMbYH1tKUQx3oB60fw+agiC WQqyPhkbyCW90jPpF8LZrGqVVEi69iLPWx6NXIeDiYoi2VDfHqELRP5vEPwYPvPGHW4x tPWB+gSd3PkgKXTQFWqOsPwNWGPnbhw88seYaA+ScR+XlanZ5TpiEc9S75xjVmfctzyl JmzStSH0xx3bRD8Bu/+clu3yYrWmEzrR5uarPPOV1N+eVcqQ/TxPNCLYHGcHpUt5FhKT +V5bQPDYutucyNRQnNpK0vQovweeDTZgMMkXZtQ2R1uOW2iWKGPt0pRHaP35gZbGKhx+ r+wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=DSSmD8HuQYMwPcGovZX4hRVdZ929E2zR6uwKjD46RdU=; b=fiQwupvG2sMiNzbMMYkRSg3I5NgJGRTn2szKXaaWd2pQTsjDosCNAXfWpO8prZJkCI VUiOnPA2S5DmAhZlz+E5pW1p6PrjaDZj2voG4oqwG3bIw0Q5fxvMnr2kFt7lW/TURWNF X80OcZtGkdVcrF0jsCIZrKMvhSIYbqoWwd2CiYk7nWZKNB8eCobP/sStlIr6v30atbkJ 1okGo1ftwdy1R/K7lyFRA9XK2gHiDIk2mu+4JKwnnGbfQi0u/EmBzd6NZ3FtRyfr8YWK RUF0mBlQzu+FKt1y/c2BphztYaZtY0SjEpdA6tUVcHcIzKzG5ajokexbtGHO5bVHHPiO S7FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=MvEqxDsy; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l140-v6si1665203wmb.201.2018.09.12.11.15.04; Wed, 12 Sep 2018 11:15:05 -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 header.s=20161025 header.b=MvEqxDsy; 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 sp=QUARANTINE 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 F1D3068A55B; Wed, 12 Sep 2018 21:14:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2BF6268A4B6 for ; Wed, 12 Sep 2018 21:14:46 +0300 (EEST) Received: by mail-qt0-f195.google.com with SMTP id k38-v6so2798762qtk.11 for ; Wed, 12 Sep 2018 11:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YeZzgBD2x0UbWh0lorgdMLHxLVOZRPudodqmSWZuHHs=; b=MvEqxDsy0el4CfHHT4Sjy4k4cwWUuehQsXEz6z03ddraVsljbjDfrcbKFDcBqrxhcS xW5EUh00DaE+GfTaGNYh7ocvqp0JrJgEE4cCdTsCm/1KN4pSvhXEK+hC0MP7G1xpr6CI m8eF35BpNyoa9zDrvX2U9lS29+LYPX0bdLgrskV87DhJeai/aDz2xSjZ8lal+ryiiWMQ gspsbse5SoG0FLbGI02/m610rmqsqTFsGWeMeXa7YvV2+fAWM3njsnhrj9v4oicAlyJz 9JQ+dF5wttuxpMRjLsDul9FvlAI2/z5p80UTCKWsOzb2ItlgF8FGa1wEP6cSOJhdX9xu xn7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YeZzgBD2x0UbWh0lorgdMLHxLVOZRPudodqmSWZuHHs=; b=e2103HD3TankQkEttYi5+RyHKsqvGNcHhDIMYIhKWUQNCAZKr/D+TGUVVi885dpbiv /J+pSFqNr6c8QdiC8g6rSILCnXfH+6Ik/6tIglWH5wAsVx9iN/ghYINVD1vIcUH+Od+V HruWPJ0YJnujJM6LSWXpIoY8vh7JwqSxUJCl2XjFxK3vByanSgMe/tDHfalzNN1fOa/X N9TRqO8A/wsM5IfB5wh30jEFXt6vgIBBmuwWyGzfgmfBNYcDypikuveTVFOFI94sjLtc av6r1MUxwhCFJsphTb8eWhcKmAqLk1gk8GU+k1MxoWWsAYqb+zN6AauaMERvvzcBwr5y H4Cw== X-Gm-Message-State: APzg51BvwqynHtKmhOVyMnpRxWgNEGqyIv/rgFwvIYm0om4tsWKa8BBc s0w5JXLT2ppPLpSd/NbV6u/bJ6k9 X-Received: by 2002:a0c:b39c:: with SMTP id t28-v6mr2531213qve.116.1536776095157; Wed, 12 Sep 2018 11:14:55 -0700 (PDT) Received: from localhost.localdomain ([181.231.186.237]) by smtp.gmail.com with ESMTPSA id 80-v6sm1068037qka.6.2018.09.12.11.14.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 11:14:54 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Sep 2018 15:14:43 -0300 Message-Id: <20180912181443.3972-1-jamrial@gmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] Revert "avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext" 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" This reverts commit f631c328e680a3dd491936b92f69970c20cdcfc7. The avcodec_parameters_to_context() call was freeing and reallocating AVCodecContext->extradata, essentially taking ownership of it, which according to the doxy is user owned. This is an API break and has produces crashes in some library users like Firefox[1]. Revert until a better solution is found to internally propagate the filtered extradata back into the decoder context. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1486080 Signed-off-by: James Almer --- Also reported in http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233584.html Commit 0c71c6d66f9ae8265158181e5b1cbc5c63525fde may have to be reverted as well. It is also an API change to require av_malloc() to be used when users have probably been using other allocators for years now, as was the case with Firefox. Suggestions to work around it are very welcome, of course. While no bitstream filter currently autoinserted by a decoder requires the filtered extradata to be propagated to work properly, we don't know what may be needed in the future, and without this the usability of bsfs in decoders is potentially limited. libavcodec/decode.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 4607e9f318..2e82f6b506 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -281,10 +281,6 @@ int ff_decode_bsfs_init(AVCodecContext *avctx) bsfs_str++; } - ret = avcodec_parameters_to_context(avctx, s->bsfs[s->nb_bsfs - 1]->par_out); - if (ret < 0) - return ret; - return 0; fail: ff_decode_bsfs_uninit(avctx);