Skip to content

Commit 884e0ed

Browse files
Fix worklet output channel iterator #413
1 parent 3a7687d commit 884e0ed

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/worklet.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,13 @@ impl AudioProcessor for AudioWorkletRenderer {
323323

324324
// Create an iterator for the output channel counts without allocating, handling also the
325325
// case where self.output_channel_count is empty.
326-
let output_channel_count = self
327-
.output_channel_count
328-
.iter()
329-
.copied()
330-
.chain(std::iter::once(inputs[0].number_of_channels()));
326+
let single_case = [inputs.get(0).map(|i| i.number_of_channels()).unwrap_or_default()];
327+
328+
let output_channel_count = if self.output_channel_count.is_empty() {
329+
single_case.iter()
330+
} else {
331+
self.output_channel_count.iter()
332+
}.copied();
331333

332334
outputs
333335
.iter_mut()

0 commit comments

Comments
 (0)