From patchwork Mon Jun 17 03:42:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13579 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 B5546444B14 for ; Mon, 17 Jun 2019 06:50:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 923E568A7D2; Mon, 17 Jun 2019 06:50:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 81EF668A774 for ; Mon, 17 Jun 2019 06:50:35 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id f9so8199536wre.12 for ; Sun, 16 Jun 2019 20:50:35 -0700 (PDT) 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=iQRGdyiPB+S3T0LKObVD+AeZHig8obs9RQv7P+Km6iQ=; b=E4tyDmI6ykuzW86P9zEhjv9g2rjlcHTKIYZ9Xz+ujoZZsIEe5OplqhTewj89W8A540 6Pm/A8nMef809WN83L72gs/tQ///32ZOqqJ9Byd/8m8242u6RDKHLMXcgMVT43C4MpcM SdCVOeDBHf5aQ2YPKzHhTWGjp2FGU17AbkftP990NaSnmP6wwNmdqit4Avckv1G2CmZx Cze/jIo28cJDL/Cmozw4GutY/IOFbuIOpaXmQt31aWqOGguTRJcghMl2ulcKXaLaZeCU f6Y501S0Fv+vXnV+07E7nOTvp4jlhc/aA+QVxRS0dWwSEnumAi553hKawQe2EqiAds33 hhyA== 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=iQRGdyiPB+S3T0LKObVD+AeZHig8obs9RQv7P+Km6iQ=; b=QbEhIVd5mjXSQ0EAGP5uRY2vI+8QTi0rQGHEY8dcfNwycNDWTivwu2ue+ESoDtAGkR 8EqBvIDqUQunGE7H4mY080wVk9CfJmCqAKMABkPG2GcStha6g3Q0XPnakQRtjpDmNL4/ swSAyK4MZGQO25D+CPFTmXvmUo/UmnTv/TymNx0kxqKSpFz4Q6dsgWU+yKju4QR2Atul pIYUiGQHY7IjJVQ+vz7xI1KG1NxbAmzUn3Xc1iTjzYc/XZSkMXu2zY6LmMt5/gZTf0t3 SEatRBjA+945DKUNQSMgwBPlTk5bgoBr5W2pdM1fuZZLy4lkbQSvMcZh4+Ga4nUf4HYH 2nIQ== X-Gm-Message-State: APjAAAXo1ykv+ltC2S4MiSlQnscyBnJeeRuVjjYe0Llu+epHYtryluJp Ml7Lgf+kqhf2RrAk6n8FFZ+C1lMn X-Google-Smtp-Source: APXvYqyTxMlI40GGgHrJZDW8wTXJc0C6npdxDrHlS1JKXydrTsgoV3nt6X2b0poMhoS2JhER8uZAKA== X-Received: by 2002:a5d:528b:: with SMTP id c11mr9302312wrv.25.1560743036253; Sun, 16 Jun 2019 20:43:56 -0700 (PDT) Received: from localhost.localdomain (ipbcc063db.dynamic.kabel-deutschland.de. [188.192.99.219]) by smtp.gmail.com with ESMTPSA id x83sm9632889wmb.42.2019.06.16.20.43.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 20:43:55 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jun 2019 05:42:09 +0200 Message-Id: <20190617034223.21195-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190617034223.21195-1-andreas.rheinhardt@gmail.com> References: <20190617034223.21195-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/18] filter_units: Don't use fake loop 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" According to the BSF API, when a BSF is finished with an input packet, it should return AVERROR(EAGAIN) to signal that another packet should be sent to the BSF via av_bsf_send_packet that the actual BSF can receive via ff_bsf_get_packet[_ref]. filter_units on the other hand simply called ff_bsf_get_packet again if the first packet received didn't result in any output. This call of course returned AVERROR(EAGAIN) which was returned, but it is nevertheless better to not include a fake loop. Signed-off-by: Andreas Rheinhardt --- libavcodec/filter_units_bsf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/filter_units_bsf.c index 0876693c81..a787933f0a 100644 --- a/libavcodec/filter_units_bsf.c +++ b/libavcodec/filter_units_bsf.c @@ -105,7 +105,6 @@ static int filter_units_filter(AVBSFContext *bsf, AVPacket *out) AVPacket *in = NULL; int err, i, j; - while (1) { err = ff_bsf_get_packet(bsf, &in); if (err < 0) return err; @@ -134,12 +133,10 @@ static int filter_units_filter(AVBSFContext *bsf, AVPacket *out) } } - if (frag->nb_units > 0) - break; - + if (frag->nb_units == 0) { // Don't return packets with nothing in them. - av_packet_free(&in); - ff_cbs_fragment_reset(ctx->cbc, frag); + err = AVERROR(EAGAIN); + goto fail; } err = ff_cbs_write_packet(ctx->cbc, out, frag);