From patchwork Tue Sep 8 21:18:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22180 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 99FED44BD83 for ; Wed, 9 Sep 2020 00:19:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7BE6968B6E2; Wed, 9 Sep 2020 00:19:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 488C268B6A0 for ; Wed, 9 Sep 2020 00:19:23 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id z4so695072wrr.4 for ; Tue, 08 Sep 2020 14:19:23 -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=rU/UIq0sClk9e6t2EtMg5QEgHmNVMD16B9Wzg3J2hM4=; b=NA26A2eLqW4R4iVUWtGmzLzDV306f0c+j0i63QYIPQtquVyOUyggzaEGi9TQAVK6AZ uxlJyPAA02UuKav4+eJGhJ7Fx55GWeGyqk3lIzU80egxekUeiBhXKNRsXzNpDcGz8AwJ 6YotSNKXWzlYEDNwCmXX4nkT3HI4TisjJEdZHwgaOuImFHsujbfZbzV7GP7+zHo1hdjw X5mhA54NIjzoieUtF2L/MyGRf/LyBtkkBniOhdLiTJT2wfehoQ2gZWsqI+mwJyLK2RhQ TDMd8x2pMo/iGSlaJkHTKRNsARFd8rz1VHWaW2A67x5ez1slYyxUd+7QRQ/BBRcvn8Rg Wakw== 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=rU/UIq0sClk9e6t2EtMg5QEgHmNVMD16B9Wzg3J2hM4=; b=SFg+79aI1jSmeAImddBjkThleEUF5CVhmpJibskRciWzGtX5ahRfhvUEsl0ECG9c5m 5GlSWKorWyqoIAlBtaa+FMvvL/S0NjHHEaGggVxxv2U+O2tAitC/s1qtouD9bV48R8Rj 7OmTAxl4LbFFNZjyp36jCX8j2CgNXwd7P6hh0/6IqGR+aHF5C+hyyP9RH6GANcCgZMrJ M6vSBiBLYWc64RMyU+b9hhsl5/qWIdQndMF9eGU2h9fjJXH4oh1k446MwCJfne9sOqxi mujIPBH3HqMSglj4xlKdQHGfrGavH7AxdG26M+5D6LcDYQk5W/fdH/NVzs35fNiE8Yd3 N8ng== X-Gm-Message-State: AOAM533Tvh+aDVA7rM/Oo7syhCWHo3Xz3RvIU6K/WEY9EL4noTw+4swj WXW9JNTitqS81L3ZFyzTzcqfuwkNRao= X-Google-Smtp-Source: ABdhPJzko+vMr3Bo/VGhV13ciXxP45oz6jDkl4liv/feGFRMP6ME+2gXwWG3rCpcBLt0x/hGtIyZIw== X-Received: by 2002:a5d:4a0e:: with SMTP id m14mr410679wrq.313.1599599962539; Tue, 08 Sep 2020 14:19:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 14:19:22 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Sep 2020 23:18:34 +0200 Message-Id: <20200908211856.16290-3-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 03/25] avfilter/af_headphone: Check for the existence of samples 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" Not providing any samples makes no sense at all. And if no samples were provided for one of the HRIR streams, one would either run into an av_assert1 in ff_inlink_consume_samples() or into a segfault in take_samples() in avfilter.c. Signed-off-by: Andreas Rheinhardt --- libavfilter/af_headphone.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 1024ff57b1..f488e0e28d 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -631,8 +631,14 @@ static int activate(AVFilterContext *ctx) if ((ret = check_ir(ctx->inputs[i], i)) < 0) return ret; - if (ff_outlink_get_status(ctx->inputs[i]) == AVERROR_EOF) + if (ff_outlink_get_status(ctx->inputs[i]) == AVERROR_EOF) { + if (!ff_inlink_queued_samples(ctx->inputs[i])) { + av_log(ctx, AV_LOG_ERROR, "No samples provided for " + "HRIR stream %d.\n", i - 1); + return AVERROR_INVALIDDATA; + } s->in[i].eof = 1; + } } for (i = 1; i < s->nb_inputs; i++) {