From patchwork Thu Nov 14 14:06:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16262 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 303E1448A9B for ; Thu, 14 Nov 2019 16:07:03 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1AC9368AC97; Thu, 14 Nov 2019 16:07:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0391768AC87 for ; Thu, 14 Nov 2019 16:06:57 +0200 (EET) Received: by mail-wm1-f65.google.com with SMTP id q70so5803724wme.1 for ; Thu, 14 Nov 2019 06:06:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0kgFRHbpfGcfuuaR9V9znHAJi0sBS9FZBJPVs0T8CV0=; b=jxCi+s17U1AFVpfYO5XXVjsPHveVyCl+NQRI5oE7yl42rZXM+6pW/8Ev1/5bL79ZLa ZRnmSOdrkT2DlbiDx/BeDFPNBmQiRE9Q1LOGlmWhiqiCFd/7tbor9QEqeC0uBOb2jvNe 6O7fiVq4gcgggwSlJaBa5syncC66IT+G44GesA9oyIwA9uJ03R06/RQx9n8Gc3YxLK8U Q3wy+mbsd51GuR1oR3bD0lDJpLkVh4AXHNVhK+EN+RogKSTvoqCo9O8aNgM/qg1iYgUd liTzk3NYtL6A7pj4aArmVS978TSQNB0HthjQL+0SB7Blc/G1Wn5+NUnmcNBCcRrhWk+O /Y9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0kgFRHbpfGcfuuaR9V9znHAJi0sBS9FZBJPVs0T8CV0=; b=JxHPbltoVfZ757QSMl293JyQoXq0Vo2JYKE0h8BqU0mQqFXeDQT6tbYY3B9iMVbo1P zIKfhWRDKsP5kfFgU/4BnTNe4eNi2L5kM1yED2AkXHqcBGBtq+ngCt5BrwFQakndR+cp 9PNOyrSmO4HS4s6EKRF0IuejKEQGIuRDTMK4e/1K21s6ubWuA7+jco78Y7385AAg3KZ+ nl/BjMsLdBQubmiShqzgrW17gz19VdQV7qQh/wlNFmKK3CcsJsJ5d+74xMe60Tb+ZgzY S6b+UKRR7zXOL5c2bZvMgRmcu/Oxd1JrrBnhToDmA9ZtCZl54qIpa+vTzLx7+2hYZnwX AevA== X-Gm-Message-State: APjAAAWno8FkQZJk0CBMOiudclc1Q7VnGmbYBwFEd/4nnhgTPqcl3m9n RlQOQng49hbg/A16djx+BnHXDGuh X-Google-Smtp-Source: APXvYqxfGl7p73SvMp06ThLurq879TqD8lgHlPAUXGRnRvfTaLcPKVvhhQVsaBTSmrJyQ/QrsTXuRg== X-Received: by 2002:a1c:9dd3:: with SMTP id g202mr8451116wme.43.1573740416310; Thu, 14 Nov 2019 06:06:56 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id s9sm5924270wmj.22.2019.11.14.06.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 06:06:55 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Nov 2019 15:06:27 +0100 Message-Id: <20191114140627.21943-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191114140627.21943-1-andreas.rheinhardt@gmail.com> References: <20191114140627.21943-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/av1dec: Redo flushing of bsf 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The current approach has two different calls to av_bsf_send_packet(): A normal one, sending a packet; and an extraordinary one just for flushing. These can be unified into one by making use of the newly documented fact that av_bsf_send_packet() allows to signal flushing via empty packets (i.e. packets without data and side-data). This also fixes CID 1455685 which resulted from the fact that the call for flushing was not checked given that it couldn't fail. Signed-off-by: Andreas Rheinhardt --- Untested as I didn't have an annex b sample. libavformat/av1dec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c index a0cad55668..5e7a057cb7 100644 --- a/libavformat/av1dec.c +++ b/libavformat/av1dec.c @@ -193,7 +193,6 @@ retry: if (avio_feof(s->pb)) { if (c->temporal_unit_size || c->frame_unit_size) return AVERROR(EIO); - av_bsf_send_packet(c->bsf, NULL); goto end; } @@ -222,6 +221,7 @@ retry: c->temporal_unit_size -= obu_unit_size + len; c->frame_unit_size -= obu_unit_size + len; +end: ret = av_bsf_send_packet(c->bsf, pkt); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Failed to send packet to " @@ -229,7 +229,6 @@ retry: return ret; } -end: ret = av_bsf_receive_packet(c->bsf, pkt); if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) av_log(s, AV_LOG_ERROR, "av1_frame_merge filter failed to "