The spec doesn't clarify how the adjustment should be made. There's one thing to keep in mind: Even for fixed loop endpoints, self.buffer_pos can be slightly outside the loop bounds when process() starts; this is because we increment buffer_pos right after outputting a sample, but only loop right before outputting a sample. Any implementation must behave the same as this, because the playback algorithm (https://webaudio.github.io/web-audio-api/#playback-AudioBufferSourceNode) is normative.
See https://github.com/servo/media/blob/86b9a2892af3774e42243ac84394a052719b2bf6/audio/buffer_source_node.rs#L125
The spec doesn't clarify how the adjustment should be made. There's one thing to keep in mind: Even for fixed loop endpoints, self.buffer_pos can be slightly outside the loop bounds when process() starts; this is because we increment buffer_pos right after outputting a sample, but only loop right before outputting a sample. Any implementation must behave the same as this, because the playback algorithm (https://webaudio.github.io/web-audio-api/#playback-AudioBufferSourceNode) is normative.