diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx index f5dbb8fd3..3a7418a4e 100644 --- a/src/decoder/plugins/OpusDecoderPlugin.cxx +++ b/src/decoder/plugins/OpusDecoderPlugin.cxx @@ -444,10 +444,12 @@ mpd_opus_scan_stream(InputStream &is, /* read at most 64 more pages */ unsigned remaining_pages = 64; + unsigned remaining_packets = 4; + bool result = false; ogg_packet packet; - while (true) { + while (remaining_packets > 0) { int r = ogg_stream_packetout(&os, &packet); if (r < 0) { result = false; @@ -466,6 +468,8 @@ mpd_opus_scan_stream(InputStream &is, continue; } + --remaining_packets; + if (packet.b_o_s) { if (!IsOpusHead(packet)) break;