Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Overflow in calculating audio timestamp
@ 2023-02-02 13:55 Alan Young
  2023-02-03  0:34 ` Takashi Sakamoto
  2023-02-03 14:45 ` Pierre-Louis Bossart
  0 siblings, 2 replies; 11+ messages in thread
From: Alan Young @ 2023-02-02 13:55 UTC (permalink / raw)
  To: alsa-devel

sound/core/pcm_lib.c:update_audio_tstamp() contains the following 
calculation:

         audio_nsecs = div_u64(audio_frames * 1000000000LL,
                 runtime->rate);

This will result in a 64-bit overflow after 4.4 days at 48000 Hz, or 1.1 
days at 192000.

Are you interested in a patch to improve this?

The same calculation occurs in a couple of other places.

Alan.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-02-06 15:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 13:55 Overflow in calculating audio timestamp Alan Young
2023-02-03  0:34 ` Takashi Sakamoto
2023-02-03 16:11   ` Alan Young
2023-02-03 18:02     ` Jaroslav Kysela
2023-02-04  0:54       ` Pierre-Louis Bossart
2023-02-06 15:25         ` Alan Young
2023-02-04  9:11       ` Alan Young
2023-02-04 15:40         ` Jaroslav Kysela
2023-02-06  8:52           ` Alan Young
2023-02-06  9:17             ` Jaroslav Kysela
2023-02-03 14:45 ` Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox