decoder/opus: limit the number of packets in _scan_stream()
This commit is contained in:
parent
e6fad97edc
commit
c731a82b71
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user