Merge pull request #50 from Tahinli/dev
perf: ⚡ I was wasting first decoded samples
This commit is contained in:
commit
3c32921458
1 changed files with 17 additions and 4 deletions
|
@ -211,8 +211,13 @@ async fn process_audio(
|
||||||
window: WindowFunction::BlackmanHarris2,
|
window: WindowFunction::BlackmanHarris2,
|
||||||
};
|
};
|
||||||
|
|
||||||
let chunk_size = match decode_audio(&mut format, track_id, &mut decoder) {
|
let (chunk_size, audio_decoded_left, audio_decoded_right) =
|
||||||
Some((audio_decoded_left_channel, _)) => audio_decoded_left_channel.len(),
|
match decode_audio(&mut format, track_id, &mut decoder) {
|
||||||
|
Some((audio_decoded_left_channel, audio_decoded_right_channel)) => (
|
||||||
|
audio_decoded_left_channel.len(),
|
||||||
|
audio_decoded_left_channel,
|
||||||
|
audio_decoded_right_channel,
|
||||||
|
),
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -225,6 +230,14 @@ async fn process_audio(
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let (audio_resampled_left, audio_resampled_right) =
|
||||||
|
resample_audio(audio_decoded_left, audio_decoded_right, &mut resampler);
|
||||||
|
|
||||||
|
for (single_left, single_right) in audio_resampled_left.iter().zip(&audio_resampled_right) {
|
||||||
|
let _ = decoded_to_playing_sender.send(*single_left as f32);
|
||||||
|
let _ = decoded_to_playing_sender.send(*single_right as f32);
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let (mut audio_decoded_left, mut audio_decoded_right) = (vec![], vec![]);
|
let (mut audio_decoded_left, mut audio_decoded_right) = (vec![], vec![]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue