From patchwork Wed Oct 30 21:58:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Niebur X-Patchwork-Id: 16041 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 DA7E7447011 for ; Wed, 30 Oct 2019 23:58:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B73F768B39D; Wed, 30 Oct 2019 23:58:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 08C5168A4F6 for ; Wed, 30 Oct 2019 23:58:21 +0200 (EET) Received: by mail-il1-f171.google.com with SMTP id m16so3503811iln.13 for ; Wed, 30 Oct 2019 14:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thuuz-com.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=syYVVaIoEen2fKuhj4Zuo1o0ipq74joCCuFU614W9OI=; b=O3QIzW+0/f5LH9d5Aw6u0xYOaTer8HtoEG1OibUFG4i5vACfy4dWkNuv4aL0Bl8tzy TLcq8cKfwBjwTtwW/z7bYrS2lnZTah/pnSbI9Lg8D3+no+lwLvLfM2q78YBFOK9d121Q 9BBpZNmRwvUwNTTpsLbM0dxCZlVDaoD3ipi2X7+hq7Nz3SBQG4RKtroOcssVXgGAf8aD igh4Tv9uxihPFeVf5Fm5UUf9/5Y+Nb51QbY6GfbbsRr1PzCkuH+hFjKXO8P/yVETCBVm 1ukrO2+o3nNSQtackUhNiSEaNYF81TU+fd1jYFTF+BWxhDmqb8ouyDbyb7DBiglr12Uc 6b/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=syYVVaIoEen2fKuhj4Zuo1o0ipq74joCCuFU614W9OI=; b=YYSZCnF8F+ms7uzQAjmT8yohPCQE6OGH4MyHSzxUBZXTLbl7S2QrCETRvLLAWV7MJs ePQbeFZipBEE2OVrYp7Gs25irAukiVjnNsPYQLQUxSQDbiWtxhE0JoeVe+pUk6jv2K7s N8L6uvhvtbANjBxonNzONpdfum0IGCXPdh/ioZF4sqSInNjzvGPz41qegcYiwlusjMGK Mr3eScnbfbjfLrPJhUxnF566KCbn6B62oQWHLOChYRe8wNkEN/gFM35MV0FkYH274B4E Ha2DQVgFG6CZwmvle1S5oMKpLIR93ZhdN5y0PUVCN9wEDwnyTKJsIPZ5SSCk0Wg7Vsv8 MEKg== X-Gm-Message-State: APjAAAVpOXdbsLUpD+DnBtsJrQPKYorvuQ+ZtSS3Z/sZFP6zLjKqrWH+ +9BPY21i5+XDADWDVzLvTABCSo+WTKERCA== X-Google-Smtp-Source: APXvYqxXYdApf3fL1Nm95NbaeK7vEUEPzpyoyk+7NIUMUan/+H+RZ8NRzrJLCnVReFPZfPkI0qfBrA== X-Received: by 2002:a92:1f44:: with SMTP id i65mr2343100ile.90.1572472699096; Wed, 30 Oct 2019 14:58:19 -0700 (PDT) Received: from ?IPv6:2601:282:2:df60:6dab:d544:cb56:df09? ([2601:282:2:df60:6dab:d544:cb56:df09]) by smtp.gmail.com with ESMTPSA id v13sm223751ili.65.2019.10.30.14.58.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2019 14:58:18 -0700 (PDT) From: Mark Niebur Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Message-Id: Date: Wed, 30 Oct 2019 15:58:17 -0600 To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3601.0.10) Subject: [FFmpeg-devel] acrossfade filter crossfading before first input is exhausted 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hello, I have been trying to use acrossfade but have been experiencing that the audio in the resulting output is totally jumbled. From stepping through the code, it appears that acrossfade is starting the crossfade before the first input is exhausted. I'm not sure why this happens from ffmpeg's point of view; I'm guessing it's from poor disk performance in docker. I have found that the following patch fixes this issue: Could you please merge this patch or merge a similar fix? Thanks, Mark Niebur diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index 23608fb..91a454b 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -485,7 +485,8 @@ static int activate(AVFilterContext *ctx) (AVRational){ 1, outlink->sample_rate }, outlink->time_base); return ff_filter_frame(outlink, in); } else if (ff_inlink_queued_samples(ctx->inputs[0]) >= s->nb_samples && - ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples) { + ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples && + s->cf0_eof) { if (s->overlap) { out = ff_get_audio_buffer(outlink, s->nb_samples); if (!out)