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:
kleines Filmröllchen 2023-06-24 17:51:24 +02:00 committed by Jelle Raaijmakers
parent 2e9e0dfe61
commit ab9c18c176

View file

@ -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);
}