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 D04E647C59 for ; Thu, 14 Dec 2023 19:13:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 00F3268D19F; Thu, 14 Dec 2023 21:13:48 +0200 (EET) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C984668CFFF for ; Thu, 14 Dec 2023 21:13:41 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2879D40007 for ; Thu, 14 Dec 2023 19:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1702581221; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O/3iKr1hxVdB7gi7KIGXe90+6KK/obXOM3f/uVG5OeA=; b=bYcjHWxmWfkH4F65xMBjdSw/rWYsaEVzIjSPr+pK0FuRCe5jIAKuVS96az1thcabILHF1R 3wlJIv2qXjq6hTyLmhKSzpwoPQac9sdMzuM8xn9BAb1J8r1lGdYWQo/CuRHScHtpNam18/ nyKsEfjurg2JwRN0V5dgo1tADlLHnStmqAtVLDlPImJbeznv4ZVNht6Vf1nV9N1ESSDj19 bef8k/I2BZa0Kyi2TQ6q8MLxm8Z0ZBc832E6FYmsnEMtdQL7KcXlI/Y35I5WQt+M/BT+nx QfB5UfDiSX2KSAXM2LkwOtkbrlqEgFlUSMrUsuL3cgfi+coUNHTcNv6O3Z+zrw== Date: Thu, 14 Dec 2023 20:13:40 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231214191340.GK6420@pb2> References: <20231212112008.2500-1-ffmpeg@gyani.pro> MIME-Version: 1.0 In-Reply-To: <20231212112008.2500-1-ffmpeg@gyani.pro> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] swr/swresample: avoid reapplication of firstpts 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 Content-Type: multipart/mixed; boundary="===============0559479270794506897==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0559479270794506897== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ah40dssYA/cDqAW1" Content-Disposition: inline --Ah40dssYA/cDqAW1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 12, 2023 at 04:50:08PM +0530, Gyan Doshi wrote: > During a resampling operation where >=20 > 1) user has specified first_pts > 2) SWR_FLAG_RESAMPLE is not set initially (directly or otherwise) > 3) first_pts has been fulfilled (always using hard compensation) >=20 > then upon first encountering a delay where a soft compensation is > required, swr_set_compensation will lead to another init of swr which > will reset outpts to the specified firstpts thus leading to an output > frame having its pts =3D firstpts. When the next input frame is received, > swr will see a large delay and inject silence from firstpts to the > current frame's pts. This can lead to severe desync and in worst case, > loss of audio playback. >=20 > Parameter initcount added to keep track of swr_init calls of the swrconte= xt > and to ultimately avoid enforcing firstpts again. >=20 > Fixes #4131. > --- > libswresample/swresample.c | 7 +++++-- > libswresample/swresample_internal.h | 1 + > libswresample/version.h | 2 +- > 3 files changed, 7 insertions(+), 3 deletions(-) Would it work to instead set firstpts =3D AV_NOPTS_VALUE on allocation and then use firstpts =3D=3D AV_NOPTS_VALUE to detect if it has been set already ? If that workes, that seems simpler than counting init thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin --Ah40dssYA/cDqAW1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZXtT4AAKCRBhHseHBAsP qz1GAJ0XKJ/ku+V69j1qNbLIXyQv0LYbgACfX1JTJozkhiB8Zz+Z7GsWU+qORAg= =b51R -----END PGP SIGNATURE----- --Ah40dssYA/cDqAW1-- --===============0559479270794506897== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============0559479270794506897==--