mirror of
https://github.com/RustAudio/rodio
synced 2024-12-14 14:12:31 +00:00
Merge pull request #320 from HalfVoxel/master
Fix crackling audio when using Sink
This commit is contained in:
commit
3bc614fc12
2 changed files with 9 additions and 4 deletions
|
@ -132,10 +132,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the size hint.
|
// Try the size hint.
|
||||||
if let Some(val) = self.current.size_hint().1 {
|
let (lower_bound, _) = self.current.size_hint();
|
||||||
if val < THRESHOLD && val != 0 {
|
// The iterator default implementation just returns 0.
|
||||||
return Some(val);
|
// That's a problematic value, so skip it.
|
||||||
}
|
if lower_bound > 0 {
|
||||||
|
return Some(lower_bound);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise we use the constant value.
|
// Otherwise we use the constant value.
|
||||||
|
|
|
@ -57,6 +57,10 @@ where
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
self.input.size_hint()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I> Source for Done<I>
|
impl<I> Source for Done<I>
|
||||||
|
|
Loading…
Reference in a new issue