mirror of
https://github.com/RustAudio/rodio
synced 2024-12-13 05:32:32 +00:00
refactor(decoder/symphonia) logic reorderd
This commit is contained in:
parent
f846cdf38d
commit
a52a41bd86
1 changed files with 12 additions and 16 deletions
|
@ -195,11 +195,10 @@ impl Iterator for SymphoniaDecoder {
|
||||||
if self.current_frame_offset == self.buffer.len() {
|
if self.current_frame_offset == self.buffer.len() {
|
||||||
let mut decode_errors: usize = 0;
|
let mut decode_errors: usize = 0;
|
||||||
let decoded = loop {
|
let decoded = loop {
|
||||||
match self.format.next_packet() {
|
let packet = self.format.next_packet().ok()?;
|
||||||
Ok(packet) => match self.decoder.decode(&packet) {
|
match self.decoder.decode(&packet) {
|
||||||
Ok(decoded) => break decoded,
|
Ok(decoded) => break decoded,
|
||||||
Err(e) => match e {
|
Err(Error::DecodeError(_)) => {
|
||||||
Error::DecodeError(_) => {
|
|
||||||
decode_errors += 1;
|
decode_errors += 1;
|
||||||
if decode_errors > MAX_DECODE_ERRORS {
|
if decode_errors > MAX_DECODE_ERRORS {
|
||||||
return None;
|
return None;
|
||||||
|
@ -207,11 +206,8 @@ impl Iterator for SymphoniaDecoder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err(_) => return None,
|
Err(_) => return None,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
self.spec = decoded.spec().to_owned();
|
self.spec = decoded.spec().to_owned();
|
||||||
self.buffer = SymphoniaDecoder::get_buffer(decoded, &self.spec);
|
self.buffer = SymphoniaDecoder::get_buffer(decoded, &self.spec);
|
||||||
|
|
Loading…
Reference in a new issue