media
media copied to clipboard
AudioParam: Running only one event per tick leads to off-by-one event_start_time
Consider the following line, from WPT (the-audioparam-interface/audioparam-method-chaining.html):
envelope.gain
.setValueAtTime(0.0, 0.0)
.linearRampToValueAtTime(1.0, 1.0);
If I understand correctly, setValueAtTime runs at tick 0. We only process one event per tick, so linearRampToValueAtTime waits until tick 1 to run, at which point event_start_time gets set: https://github.com/servo/media/blob/eafa387be6424c99efc11231c9c5a03284116ddb/audio/param.rs#L150 The linearRamp line then starts at this point (value 0 at tick 1), when it should have started at tick 0.
Oh, hmm. I fixed one off by one but I vaguely recall seeing similar stuff afterwards. Thanks for investigating!
The two ifs here should probably have their own tryrecv loops
https://github.com/servo/media/blob/master/audio/render_thread.rs#L296