Hi Jaroslav,
On 04/02/2023 15:40, Jaroslav Kysela wrote:
For 32-bit apps the boundary is near to UINT32_MAX (see
recalculate_boundary() function). So only one crossing point is not
enough to cover a decent time range.
There should be a better check, if the add operation crosses the U64
range for snd_BUG_ON. In my eyes, it looks safer to use counter here
and do the checks
in the function which uses this value.
I think you are misunderstanding how crossed_boundary is used. It
relates to a single call of snd_pcm_update_hw_ptr0(), which should be
called once per period, or at the very least once per buffer-size. In
its processing, it may be detected that the boundary has been crossed.
There are three separate tests that could result in this but only one
should actually happen during a single call. The snd_BUG_ON() is just to
detect (report on) a failure in that logic.
None of this restricts the total number of frames that might be
processed, as a result of multiple boundary crossings.
Changing hw_ptr_wrap to be a boundary-wrap-counter instead of its
current use as the cumulative number of frames processed at boundary
wraps would not make any useful difference.
Unless there is something else that I'm missing....
Alan.