mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibAudio: Don't try to resample FLAC frames with sample rate 0
Although this sample rate is more or less bogus, we might as well not crash.
This commit is contained in:
parent
2e9e0dfe61
commit
ab9c18c176
Notes:
sideshowbarker
2024-07-17 20:33:50 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: ab9c18c176
Pull-request: https://github.com/SerenityOS/serenity/pull/19651
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/gmta ✅
1 changed files with 4 additions and 0 deletions
|
@ -699,6 +699,10 @@ ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::parse_subframe(FlacSubframeH
|
|||
samples[i] <<= subframe_header.wasted_bits_per_sample;
|
||||
}
|
||||
|
||||
// Resamplers VERIFY that the sample rate is non-zero.
|
||||
if (m_current_frame->sample_rate == 0 || m_sample_rate == 0)
|
||||
return samples;
|
||||
|
||||
ResampleHelper<i32> resampler(m_current_frame->sample_rate, m_sample_rate);
|
||||
return resampler.resample(samples);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue