b=967924 correct resampler input buffer sample count estimate math r=padenot

--HG--
extra : transplant_source : %15%90%0C%22_%99%BFK%14%93%28L%23hZ1%FE%B7NB
test for bug 952756

--HG--
extra : transplant_source : %7E%B4%3C%8B%F6m%B3%CD%12%F4%93%FB%A1%D3%21%D5%F6Q%AFz
b=967972 change DURATION engine parameter to BUFFEREND r=padenot

--HG--
extra : transplant_source : %B4%F3i%7FV%A95F%D0%BD%C4%E6u%03%F7%04%7Di%7C%A9
b=967972 include offset in buffer position r=padenot

There is a change in behaviour re the offset parameter when changing the
buffer while playing to one with a different sample rate, but I'm not clear
that what we current do with mPosition in that situation is best anyway.  I
think the main thing is to ensure playback from the same place if the buffer
is changed to one with the same sample rate.

--HG--
extra : transplant_source : %17%40%15%12L%9E%05et%C2o%BE%15%D7%C7%F4%ED%5E%24q
b=967992 test to check for ended event when source buffer is replaced with another shorter than offset

--HG--
extra : transplant_source : -HA%5D%8E%10%1B%14%E8%E2A%9Al%CF%A5d%7D%A3%9B%A1
b=967992 dispatch ended event, remove playing ref when source buffer is replaced with one shorter than offset r=padenot

Sending an updated BUFFEREND will stop playback appropriately.

--HG--
extra : transplant_source : %17%81%5D%B5%CD%F1%7F%EC%23%28%F5D%E4oh%DB%9F%E7%210
b=967992 collect unreferenced AudioBufferSourceNodes with no buffer r=padenot

The playing ref now only exists while there is a buffer.
We don't currently dispatch ended events when there is no buffer.

--HG--
extra : transplant_source : Ba%0BRD%89%96%99%F14%B6%40%3D%B2%C1%D5%28%D6%15%12