From patchwork Mon Apr 4 11:30:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35197 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c05:b0:7a:e998:b410 with SMTP id bw5csp1915926pzb; Mon, 4 Apr 2022 04:41:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPAjKhR+OCqJwy40zHehoikF6A+RLO6p77RleBdk7/83FRSeHXPoZVeoV7D8fMipx81mS4 X-Received: by 2002:a17:906:9c8e:b0:6df:f6bf:7902 with SMTP id fj14-20020a1709069c8e00b006dff6bf7902mr10362734ejc.191.1649072459897; Mon, 04 Apr 2022 04:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649072459; cv=none; d=google.com; s=arc-20160816; b=GGEPdqO70DRvZcKoJfZ/2kwSMBZk1f3CImLEo5P5HOQqCMjNxmjiCxy0bqPSEdMGnl r/bGarKcchslWeP/uZa22iSec48jltZN0whRnW/XjXz50ChsuqNh5cm8ULSVEPYae+v/ R7onRCFqZ7phYYGejghx7FePxH/2R0t+E4rVWr66X0mLnmEt4JiUpVqfCDDg6wYg8tYS agdtgUOv0vtinXr4rQl95XKR3B+WbBV7J13FbqY+xJoxVFESoNwSQcNHE05IzE1jtCgQ TB5fYjVBklO5BoNGOooAfpCn1b7tSr1Vxt2d+vaQJbL9DyJIb1i3Jjz53MQVdDdU16IT I6Vw== 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:references:in-reply-to:message-id :date:to:from:delivered-to; bh=RJIXBJrWGQQRT4IEmIcrkXdGoSi+OXqRISpLHSfzk+U=; b=Z6DYQYSWfSZSUb4nF10J2zCPmhJiCc17HoobLgeZwoUYXzza28hg6iviSdu6hytLay l9cjRWH1QIlYfqxyhOl4PJulP9P2TjJ8O8axuxejKnyLu5BKNqynwgXSVQ9hs8KQ3OGB phfrl7mQ917Sjy35BW66vfMMwKuYFnhRvLk9q9v8bqGzksMyychbYjKzQz1480z0WqX5 mwrwdemGX46DZvHLV3HuF4s/pq9u5wJauxQsjGtRl2GDEAR8Zgi9zbF+GKLCYGouvtxB 3aCtteSs/aIdD0/cRy3SMWbWuoEdo/po4W4SCh71fwLw9FsHfcG5bqFWqDMa6slUdeKq A/ag== 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 bl17-20020a170906c25100b006e6c61a654fsi3688866ejb.635.2022.04.04.04.40.57; Mon, 04 Apr 2022 04:40: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 23E0268B2DF; Mon, 4 Apr 2022 14:38:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9013B68B359 for ; Mon, 4 Apr 2022 14:37:46 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4D35A240507 for ; Mon, 4 Apr 2022 13:37:46 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zUgneuJVo_Y4 for ; Mon, 4 Apr 2022 13:37:45 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E7608240592 for ; Mon, 4 Apr 2022 13:37:41 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 3D7E73A0E34; Mon, 4 Apr 2022 13:32:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Apr 2022 13:30:30 +0200 Message-Id: <20220404113037.13070-43-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220404113037.13070-1-anton@khirnov.net> References: <20220404113037.13070-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 42/49] fftools/ffmpeg_mux: simplify submit_packet() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: lqndpBA8Evrd --- fftools/ffmpeg_mux.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 37ae61fee8..2cdbd5feef 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -258,18 +258,14 @@ static int submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) { int ret; - if (of->mux->header_written) { + if (of->mux->header_written) return write_packet(of, ost, pkt); - } else { - /* the muxer is not initialized yet, buffer the packet */ - ret = queue_packet(of, ost, pkt); - if (ret < 0) { - av_packet_unref(pkt); - return ret; - } - } - return 0; + /* the muxer is not initialized yet, buffer the packet */ + ret = queue_packet(of, ost, pkt); + if (ret < 0) + av_packet_unref(pkt); + return ret; } int of_submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)