On Wed, 17 Jun 2020 12:14:42 +0100 (BST) Mark Hills <mark@xxxxxxxx> wrote: > On Wed, 17 Jun 2020, Giuliano Pochini wrote: > [...] > > - pipe->position += step; /* bytes */ > > - > > - buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size); > > - > > - while (pipe->position >= buffer_bytes) > > - pipe->position -= buffer_bytes; > > - > > return 1; > > I think this risks returning to a case where it concludes nothing > advances if the counter advances by a whole buffer? Yes, it can, but you can detect that case checking for step >= period_bytes. > You might be able to do the comparison before wrapping pipe_position, but > hopefully you'll consider my patch in reply to Takashi has more clarity. Your patch is very interesting. I didn't take into account the idea of advancing the position by full periods only. If the PCM subsystem hasn't changed much since I last checked (I wrote the driver many years ago), it should work fine (and I'm sure you tested it). But I don't know if something else requires better resolution. -- Giuliano.