Commit c731a82b authored by Max Kellermann's avatar Max Kellermann

decoder/opus: limit the number of packets in _scan_stream()

parent e6fad97e
...@@ -444,10 +444,12 @@ mpd_opus_scan_stream(InputStream &is, ...@@ -444,10 +444,12 @@ mpd_opus_scan_stream(InputStream &is,
/* read at most 64 more pages */ /* read at most 64 more pages */
unsigned remaining_pages = 64; unsigned remaining_pages = 64;
unsigned remaining_packets = 4;
bool result = false; bool result = false;
ogg_packet packet; ogg_packet packet;
while (true) { while (remaining_packets > 0) {
int r = ogg_stream_packetout(&os, &packet); int r = ogg_stream_packetout(&os, &packet);
if (r < 0) { if (r < 0) {
result = false; result = false;
...@@ -466,6 +468,8 @@ mpd_opus_scan_stream(InputStream &is, ...@@ -466,6 +468,8 @@ mpd_opus_scan_stream(InputStream &is,
continue; continue;
} }
--remaining_packets;
if (packet.b_o_s) { if (packet.b_o_s) {
if (!IsOpusHead(packet)) if (!IsOpusHead(packet))
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment