Do not skip buffer update during copyToChannel

This commit is contained in:
Fernando Jiménez Moreno 2018-09-18 17:45:03 +02:00
parent a81389268a
commit 346d705c66

View file

@ -238,18 +238,14 @@ impl AudioBufferMethods for AudioBuffer {
let mut dest = Vec::with_capacity(destination.len());
// We either copy form js_channels or shared_channels.
let js_channel = self.js_channels.borrow()[channel_number].get();
if !js_channel.is_null() {
typedarray!(in(cx) let array: Float32Array = js_channel);
if let Ok(array) = array {
let data = unsafe { array.as_slice() };
dest.extend_from_slice(&data[offset..offset + bytes_to_copy]);
return Ok(());
}
}
if let Some(shared_channel) = self.shared_channels.borrow().buffers.get(channel_number) {
} else if let Some(shared_channel) = self.shared_channels.borrow().buffers.get(channel_number) {
dest.extend_from_slice(&shared_channel.as_slice()[offset..offset + bytes_to_copy]);
}