Merge pull request #320 from HalfVoxel/master

Fix crackling audio when using Sink
This commit is contained in:
est31 2020-10-03 11:30:02 +02:00 committed by GitHub
commit 3bc614fc12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -132,10 +132,11 @@ where
}
// Try the size hint.
if let Some(val) = self.current.size_hint().1 {
if val < THRESHOLD && val != 0 {
return Some(val);
}
let (lower_bound, _) = self.current.size_hint();
// The iterator default implementation just returns 0.
// That's a problematic value, so skip it.
if lower_bound > 0 {
return Some(lower_bound);
}
// Otherwise we use the constant value.

View file

@ -57,6 +57,10 @@ where
}
next
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.input.size_hint()
}
}
impl<I> Source for Done<I>