1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:08:10 +00:00

LibAudio: Add a seek point at the first sample in MP3Loader

A previous commit made it so that SeekTable doesn't provide a seek
point from `seek_point_before()` if there is not a seek point before
the requested sample index. However, MP3Loader was only setting a seek
point after the first 10 frames, meaning that it would do nothing when
seeking back to 0.

To fix this, add a seek point at byte 0 for the first sample, so that
`seek_point_before()` will never fail.
This commit is contained in:
Zaggy1024 2023-08-03 16:00:37 -05:00 committed by Sam Atkins
parent cf9565551a
commit a112e2f8c5

View file

@ -146,6 +146,7 @@ MaybeLoaderError MP3LoaderPlugin::build_seek_table()
int sample_count = 0;
size_t frame_count = 0;
m_seek_table = {};
TRY(m_seek_table.insert_seek_point({ 0, 0 }));
m_bitstream->align_to_byte_boundary();