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 7D55446001 for ; Fri, 28 Apr 2023 19:24:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 23EA568C035; Fri, 28 Apr 2023 22:24:53 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3EBA168BF93 for ; Fri, 28 Apr 2023 22:24:46 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 6ED9E240004 for ; Fri, 28 Apr 2023 19:24:45 +0000 (UTC) Date: Fri, 28 Apr 2023 21:24:44 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230428192444.GF275832@pb2> References: <20230427142601.2613-1-anton@khirnov.net> <20230427142601.2613-16-anton@khirnov.net> <20230428114217.GE275832@pb2> <168268747635.3843.467810343388947412@lain.khirnov.net> MIME-Version: 1.0 In-Reply-To: <168268747635.3843.467810343388947412@lain.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg: rework audio-decode timestamp handling 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="===============8795385533344727638==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8795385533344727638== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OzigliFs3e0dNr73" Content-Disposition: inline --OzigliFs3e0dNr73 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 28, 2023 at 03:11:16PM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2023-04-28 13:42:17) > > On Thu, Apr 27, 2023 at 04:25:56PM +0200, Anton Khirnov wrote: > > > Stop using InputStream.dts for generating missing timestamps for deco= ded > > > frames, because it contains pre-decoding timestamps and there may be > > > arbitrary amount of delay between input packets and output frames (e.= g. > > > dependent on the thread count when frame threading is used). It is al= so > > > in AV_TIME_BASE (i.e. microseconds), which may introduce unnecessary > > > rounding issues. > > >=20 > >=20 > > > New code maintains a timebase that is the inverse of the LCM of all t= he > > > samplerates seen so far, and thus can accurately represent every audio > >=20 > > if the LCM fits in int32 > >=20 > > This can hit some pathologic cases though > > consider a 192khz stream that starts with a damaged packet thats read a= s 11.197 khz > > lcm of 192000 and 11197 > 2^31 so the whole stream will then be stuck w= ith 11.197khz > > that seems like a bad choice > > the code should favor standard sample rates as well as the higher sampl= e rate if > > the lcm is not representable > >=20 > > also if lets say there are 48khz and 48.001khz where again lcm doesnt w= ork=20 > > then a multiple of 48khz may be a better choice than either itself >=20 > Thank you, there are good points. I'm wondering if just picking the LCM > of all common samplerates (28224000 =3D lcm(192000, 44100)) wouldn't be > sufficient for all these pathological cases. Or do you have a better > general algorithm in mind? Maybe fall back on AV_TIME_BASE instead? 28224000 is an option, so is AV_TIME_BASE. Neither contain 90khz though=20 which is the mpeg-ps/ts "timebase". But i have the feeling if we keep adding things then we will hit 32bit soon.=20 28224000 is better for exactly representing timestamps, AV_TIME_BASE may be easier for debuging. thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu --OzigliFs3e0dNr73 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZEwdbgAKCRBhHseHBAsP q5kEAJ4ike3MMPHEaTnS1UGvV1HcSd8kPwCePizMnwNDqLiCJ+rj1VPXxt7wzUY= =ulhN -----END PGP SIGNATURE----- --OzigliFs3e0dNr73-- --===============8795385533344727638== 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". --===============8795385533344727638==--