Fixing HandleCancelValues() to handle two canceled events next to each other

With the following code, the resulting sound should be 3 different linear ramps.
With current chromium, you only get 2 ramps, the first and 3rd one.
The middle ramp ends up being a constant value from t1 to t2.

gain.gain.setValueAtTime(0, 0)
gain.gain.linearRampToValueAtTime(1, 5)
gain.gain.cancelAndHoldAtTime(1)
gain.gain.linearRampToValueAtTime(1, 3)
gain.gain.cancelAndHoldAtTime(2)
gain.gain.linearRampToValueAtTime(1, 4)

Inside `HandleCancelValues()`,
the code decides that nothing special should be done when
the current and next event is a cancel values event,
leaving the default cancelled value unchanged,
meaning the rendered value will stay the same until the next event.

The change I made makes it so that `HandleCancelValues()`
will set the default cancelled value based off of the 2nd cancel event's saved event.

Bug: 904244

Change-Id: Icfee39da2ae6e405fcd3b814973a8a367a431c87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1644248
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668014}
3 files changed