mirror of
https://github.com/RustAudio/rodio
synced 2024-11-10 14:14:21 +00:00
Merge pull request #20 from tomaka/fix-samples-rate-conv
Fix samples rate converter not working when from == to
This commit is contained in:
commit
5d08939ff8
2 changed files with 6 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue