mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Handle case when OfflineAudioContext doesn't receive all the buffers
This commit is contained in:
parent
304e09732e
commit
ceb2cd2279
1 changed files with 5 additions and 1 deletions
|
@ -151,10 +151,14 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
|
|||
task!(resolve: move || {
|
||||
let this = this.root();
|
||||
let processed_audio = processed_audio.lock().unwrap();
|
||||
let processed_audio: Vec<_> = processed_audio
|
||||
let mut processed_audio: Vec<_> = processed_audio
|
||||
.chunks(this.length as usize)
|
||||
.map(|channel| channel.to_vec())
|
||||
.collect();
|
||||
// it can end up being empty if the task failed
|
||||
if processed_audio.len() != this.length as usize {
|
||||
processed_audio.resize(this.length as usize, Vec::new())
|
||||
}
|
||||
let buffer = AudioBuffer::new(
|
||||
&this.global().as_window(),
|
||||
this.channel_count,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue