mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
fixed channels indexing in progress callback in BaseAudioContext.DecodeAudioData
Gstreamer backend returns channel as single bit mask (ie 1, 2, 4, 8, 32 etc). Progress callback was using this mask as plain channel index, thus storing decoded audio in wrong channel.
This commit is contained in:
parent
0b05b5ed87
commit
492faa3105
1 changed files with 7 additions and 4 deletions
|
@ -481,14 +481,17 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
.unwrap()
|
||||
.resize(channel_count as usize, Vec::new());
|
||||
})
|
||||
.progress(move |buffer, channel_pos| {
|
||||
.progress(move |buffer, channel_pos_mask| {
|
||||
let mut decoded_audio = decoded_audio_.lock().unwrap();
|
||||
let mut channels = channels.lock().unwrap();
|
||||
let channel = match channels.entry(channel_pos) {
|
||||
let channel = match channels.entry(channel_pos_mask) {
|
||||
Entry::Occupied(entry) => *entry.get(),
|
||||
Entry::Vacant(entry) => *entry.insert(decoded_audio.len()),
|
||||
Entry::Vacant(entry) => {
|
||||
let x = (channel_pos_mask as f32).log2() as usize;
|
||||
*entry.insert(x)
|
||||
},
|
||||
};
|
||||
decoded_audio[(channel - 1) as usize].extend_from_slice((*buffer).as_ref());
|
||||
decoded_audio[channel].extend_from_slice((*buffer).as_ref());
|
||||
})
|
||||
.eos(move || {
|
||||
let _ = task_source.queue_with_canceller(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue