Merge pull request #20 from tomaka/fix-samples-rate-conv

Fix samples rate converter not working when from == to
This commit is contained in:
tomaka 2015-09-22 21:52:27 +02:00
commit 5d08939ff8
2 changed files with 6 additions and 1 deletions

View file

@ -74,6 +74,11 @@ impl<I> Iterator for SamplesRateConverter<I> where I: Iterator, I::Item: Sample
type Item = I::Item;
fn next(&mut self) -> Option<I::Item> {
// the algorithm below doesn't work if `self.from == self.to`
if self.from == self.to {
return self.input.next();
}
if self.output_buffer.len() >= 1 {
return Some(self.output_buffer.remove(0));
}

View file

@ -116,7 +116,7 @@ fn is_wave<R>(mut data: R) -> bool where R: Read + Seek {
impl Decoder for WavDecoder {
fn write(&mut self) -> u64 {
let (min, _) = self.reader.size_hint();
let min = cmp::min(min, 10240); // using a minimal value so that filters get applied
let min = cmp::min(min, 10240); // using a maximal value so that filters get applied
// quickly
if min == 0 {