From patchwork Tue Sep 8 21:18:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22179 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 B3F7744BD83 for ; Wed, 9 Sep 2020 00:19:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9D09568B6DF; Wed, 9 Sep 2020 00:19:29 +0300 (EEST) 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 5D42C68B6AA for ; Wed, 9 Sep 2020 00:19:27 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id q9so356239wmj.2 for ; Tue, 08 Sep 2020 14:19:27 -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=EKB+3nEcyA8TSqQL0hyGVcRTMBTLE5vEAYw1wMAs/yQ=; b=H6c+UWOrHGcZ29ej8ZkNMJwv1lTovpBOiIFSJqKQBze22+k+KYGSNJYEk2l367Z1D8 m+OOM/YDNqa2LS1pWSVZFp8KVoCfp1rG99Q2SdIo4mIOBUYArrF+o0uj38hGDnDKwHSV 5t3ZR9f62teX+dmFtB8PcXwk+a8BpYm5eLKS8CN4K+rYF+h2BWhaGPX2JiFjE971Q0Cb ZdlZpZvR9YxOQy+3yKNjvZCTEngqCwuZnZOSTNx+4brgEsXeo0+SuI1So3+HLRWiWeV/ Q7K8I8amd35Ewy4j9C8E5+xx8ohA/TUJ3tbgaKy0XnHI2OCicsklzhce91Gi/ihhH9A1 r5Ng== 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=EKB+3nEcyA8TSqQL0hyGVcRTMBTLE5vEAYw1wMAs/yQ=; b=BcH5ONgrytn3kBXLGP7E+nevAyVqo7UI6FJcq/kV/jksP47wgchIPMI/9Gn7bpe9si EiGiFwJveOqC1uQbA5L4StH+UdMjGbxVKC7fnE8HBpLCVIfYG+ZwQF+t/CXGNLCvWpn2 KQQyIL4Sw+bYJCzrWUQRSb/BPhXnSrHScdEW5fIgT/7FoqLLfQnxJZuqngoeFrGDuS/J C3M1K4Oxkc3j3D8EKNMaQjBZ9okxqaCQ0R0InPKLCst628EqDcPuB/tOi3Oymn8P6XV9 MZFL1Oqcga8AqxGDYJiW2Vpr8v+LOT/sFSJVNBfUvU//7tgyZacsDOUJBz+Nn9msRseU nysw== X-Gm-Message-State: AOAM533PmKG2ZvV7NTis5uWanB3axiKLO1h96HXprhEWgrSd9+AG8GK6 c6RcCFxKdOxkz772DyGs1FTJs0l3A4M= X-Google-Smtp-Source: ABdhPJw3aMIvMn2EtUEvUw47Z+2Nr1WtKKBmO6w6oX7y8dnB9qH2ckv3yNmC86FvCiLboS8BczXGTQ== X-Received: by 2002:a1c:2903:: with SMTP id p3mr341314wmp.170.1599599966614; Tue, 08 Sep 2020 14:19:26 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id a15sm1074304wrn.3.2020.09.08.14.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 14:19:25 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Sep 2020 23:18:38 +0200 Message-Id: <20200908211856.16290-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200908211856.16290-1-andreas.rheinhardt@gmail.com> References: <20200908211856.16290-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/25] avfilter/af_headphone: Combine several loops when checking for EOF 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" Signed-off-by: Andreas Rheinhardt --- libavfilter/af_headphone.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 42adc82df8..c71f43c5c8 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -633,6 +633,7 @@ static int activate(AVFilterContext *ctx) FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[0], ctx); if (!s->eof_hrirs) { + int eof = 1; for (i = 1; i < s->nb_inputs; i++) { if (s->in[i].eof) continue; @@ -647,26 +648,15 @@ static int activate(AVFilterContext *ctx) return AVERROR_INVALIDDATA; } s->in[i].eof = 1; + } else { + if (ff_outlink_frame_wanted(ctx->outputs[0])) + ff_inlink_request_frame(ctx->inputs[i]); + eof = 0; } } - - for (i = 1; i < s->nb_inputs; i++) { - if (!s->in[i].eof) - break; - } - - if (i != s->nb_inputs) { - if (ff_outlink_frame_wanted(ctx->outputs[0])) { - for (i = 1; i < s->nb_inputs; i++) { - if (!s->in[i].eof) - ff_inlink_request_frame(ctx->inputs[i]); - } - } - + if (!eof) return 0; - } else { - s->eof_hrirs = 1; - } + s->eof_hrirs = 1; } if (!s->have_hrirs && s->eof_hrirs) {