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

This commit is contained in:
Max Kellermann 2016-04-19 13:07:28 +02:00
parent e6fad97edc
commit c731a82b71

View File

@ -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;