From 943a67c805479f14f6843ced8897a583b433f8a1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 25 Jan 2020 20:04:22 +0100 Subject: [PATCH] decoder/ogg: need to sync small files while looking for EOS When calling OggSeekFindEOS() from inside a OggVisitor callback, then the #InputStream may be in the middle of an Ogg packet, and the newly initialized #ogg_sync_state will not be able to load it without the help of ogg_sync_pageseek(). By passing "synced=false" to OggSeekFindEOS(), we force the use of ogg_sync_pageseek() even when not actually seeking. Closes https://github.com/MusicPlayerDaemon/MPD/issues/719 --- src/decoder/plugins/OggDecoder.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/decoder/plugins/OggDecoder.cxx b/src/decoder/plugins/OggDecoder.cxx index 059b1488f..c1caf59d7 100644 --- a/src/decoder/plugins/OggDecoder.cxx +++ b/src/decoder/plugins/OggDecoder.cxx @@ -47,8 +47,12 @@ OggDecoder::LoadEndPacket(ogg_packet &packet) const DecoderReader reader(client, input_stream); OggSyncState sync2(reader); OggStreamState stream2(GetSerialNo()); + + /* passing synced=false because we're inside an + OggVisitor callback, and our InputStream may be in + the middle of an Ogg packet */ result = OggSeekFindEOS(sync2, stream2, packet, - input_stream); + input_stream, false); } /* restore the previous file position */