From a112e2f8c5e5104328b84ee238458b5c676c0c12 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Thu, 3 Aug 2023 16:00:37 -0500 Subject: [PATCH] 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. --- Userland/Libraries/LibAudio/MP3Loader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibAudio/MP3Loader.cpp b/Userland/Libraries/LibAudio/MP3Loader.cpp index 33d7ce5dc8..0d22d2417a 100644 --- a/Userland/Libraries/LibAudio/MP3Loader.cpp +++ b/Userland/Libraries/LibAudio/MP3Loader.cpp @@ -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();