demux: mock: generate PCR with vlc_tick_wait
Using vlc_tick_sleep means that errors due to scheduling are added after each sleep, and that time between two sleeps is not accounted.
SetPCR SetPCR SetPCR
v v v
|----| |------| |----|
^ ^ Error not accounted
Time between SetPCR not accounted
-- Example of bad scheduling leading to increasing error.
Using vlc_tick_wait with deadline incremented by the PCR step means that systematic scheduling errors are not summed and only bias the call to SetPCR by adding a const delay. It's also more robust against delay between each SetPCR call.
SetPCR SetPCR SetPCR
v v v
| | | | | |
|----| |---| |-----|
-- Example of bad scheduling without increasing error.
Since SetPCR calls are not affected by a constant systemic error on the
time of each call (since the reference also has the error), there's no
problem removing the delay delay / 1000
also.
SetPCR SetPCR SetPCR
v v v
| | | | | |
|----| |---| |-----|
-- Example of constant error.