On 03/02/2013 09:33 PM, Tanu Kaskinen wrote: > On Sat, 2013-03-02 at 08:56 +0600, Dmitri Paduchikh wrote: >> David Henningsson wrote: >> >>> Things remaining are: >>> - First, I'm not sure the calculations are entirely correct. I think I shouldn't need >>> to add process_usec to the wakeup, but if I don't I wake up a few samples before the >>> stream has finished playback. >> >> Sorry if it is a silly question but couldn't this happen because speed >> of time inside sound card is somewhat different from that of system >> time? > > That sounds plausible. Also, the timeout argument for ppoll() indicates > the *maximum* sleep time. Interestingly, the timeout argument for poll() > indicates the *minimum* sleep time. pa_rtpoll_run() may use either, > depending on the system... > It could be, and there are also these comments later on: /* Convert from the sound card time domain to the * system time domain */ /* We don't trust the conversion, so we wake up whatever comes first */ ...which doesn't exactly work in our favour here. Anyway, I need to go back and check more deeply what causes us to wake up earlier than expected. -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic