From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id EE91D46D59 for ; Thu, 7 Mar 2024 23:04:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 16DD668C5E6; Fri, 8 Mar 2024 01:04:36 +0200 (EET) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBB7368C5E6 for ; Fri, 8 Mar 2024 01:04:29 +0200 (EET) Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-29a74c88f74so215738a91.3 for ; Thu, 07 Mar 2024 15:04:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709852667; x=1710457467; darn=ffmpeg.org; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sCRThrEVdcnlcjifmmHbrwX/CroCKzKfCLNRbkVIXW8=; b=RlhOttR9xGa1WiSKKwVHC+9g5+nNPXfIg4BtSqgYxTXarMuGxlvHXON6B36UB4Hnn0 sg4ni/u+E7lfUh8SYRsXMuYAxht0/bUOWPq31pg+QKaQN1yOyhtR97+Zk/AjQeRoJKGK Tbatr8Xzhler6HCCMF+FDuQa3zB4w+y+2n6HSCDlP3W1aZvgmku1NVFFl2+RhmLBniHi LZ4iQF7u23nMSJogZd9M19OtkSxtlQNFkIe7+T0IQaLTtpzPv/+oDTWYZzuWoNINo8Gw fomwMXrbXv6f/HfuWOHGv2TzZQoNlsF/TEUyx/wxD+FAWu1r6Cs4N17WMlG8XKhW+Vus uiqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852667; x=1710457467; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sCRThrEVdcnlcjifmmHbrwX/CroCKzKfCLNRbkVIXW8=; b=Jj7UlrHEcYYopj20i5GXWsZAxlTl73WoSxTJyPv4H0NWDUMx9KNbFzbNvrJEvXWW2f TdbkDxgZz52RoyqHA/Lv6AtZJDXWFFGP14XdoEDYIP+Tz48v6MTQz1i/dsfpxnp6yIwY PlLE/MBn+Hvo/GPSp8mcer0BG0SSI5Z3JpKzJk5tec9qKVSJN/G97OeiWB6W25PRwlsY PygRRgCWH5F8t1a4egrwBHpc4VUaOaAk8NPTxtJJrV3m866DFvRYYwCu8g2WL5BseDtp N1aIGCqyuXjNfDPL4EYSy0ATtp6j7Pm3r8CGwqjjR6gAZdwMqj347MnH836ko+JCk4o5 4QrA== X-Gm-Message-State: AOJu0YwRJooiTWjKC6gzBIXRDF1uzGmWHTnoXqQK726+V86MRcUpxvTI DuIkV9XKwEEcvO83D5cyPK9Jb5bT1soFRsTiSlf1nIizess14CV8qm/loJS8PsiCtg== X-Google-Smtp-Source: AGHT+IGC4M5eX+9wic0aJhWpCD0pOt+1Bv3zNlrW1yABDINZJ0UI8SxgyV7nYRlc2BHKGIFB3N6tNQ== X-Received: by 2002:a17:90a:5d81:b0:29b:6f3f:c013 with SMTP id t1-20020a17090a5d8100b0029b6f3fc013mr8217099pji.48.1709852666971; Thu, 07 Mar 2024 15:04:26 -0800 (PST) Received: from ?IPV6:2409:40e1:cc:b291:139f:1f68:84b4:f494? ([2409:40e1:cc:b291:139f:1f68:84b4:f494]) by smtp.gmail.com with ESMTPSA id fv6-20020a17090b0e8600b0029ba4311a6dsm794429pjb.57.2024.03.07.15.04.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Mar 2024 15:04:26 -0800 (PST) Message-ID: <2bc308e6-91ac-4d0c-8e31-b7e3486bdcc2@gmail.com> Date: Fri, 8 Mar 2024 04:34:21 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Rajiv Harlalka To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] af_tempo.c: fix checking of samples and zero frame counts 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 Cc: thilo.borgmann@mail.de, cosmin@cosmin.at Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Check for zeros equal to the total samples early, because in case the check is true we would already be leaving the first few frames out. Signed-off-by: Rajiv Harlalka #10692 --- libavfilter/af_atempo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 4621b67b03..8f31c5beaf 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -531,21 +531,20 @@ static int yae_load_frag(ATempoContext *atempo, dst = frag->data; start = atempo->position[0] - atempo->size; - zeros = 0; + // what we don't have we substitute with zeros: + zeros = frag->position[0] < start ? FFMIN(start - frag->position[0], (int64_t)nsamples) : 0; + + if (zeros == nsamples) { + return 0; + } if (frag->position[0] < start) { - // what we don't have we substitute with zeros: - zeros = FFMIN(start - frag->position[0], (int64_t)nsamples); av_assert0(zeros != nsamples); memset(dst, 0, zeros * atempo->stride); dst += zeros * atempo->stride; } - if (zeros == nsamples) { - return 0; - } - // get the remaining data from the ring buffer: na = (atempo->head < atempo->tail ? atempo->tail - atempo->head : -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".