diff options
author | Marton Balint <cus@passwd.hu> | 2021-11-07 18:21:17 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-11-14 18:30:57 +0100 |
commit | 406ffd9b9b99fa096bcfe31b467453824d1542e7 (patch) | |
tree | 38caa77622a1fe7fbda536907c13cd759e457164 /libavformat/demux.c | |
parent | 0a9edac48eacc0f914f489dc7953a51bf24bb99c (diff) |
avformat/demux: allow total size of packets in raw_packet_buffer to reach probesize
Previously this was hardcoded to 2500000 bytes, so probing of the stream codecs
was always limited by this, and not probesize.
Also keep track of the actual size of packets in raw_packet_buffer and not the
remaining size for simplicity.
Fixes ticket #5860.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/demux.c')
-rw-r--r-- | libavformat/demux.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/demux.c b/libavformat/demux.c index 71a1a9bf03..745dc8687c 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -328,7 +328,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, if (s->pb && !si->data_offset) si->data_offset = avio_tell(s->pb); - si->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; + si->raw_packet_buffer_size = 0; update_stream_avctx(s); @@ -432,7 +432,7 @@ no_packet: } } - end = si->raw_packet_buffer_remaining_size <= 0 + end = si->raw_packet_buffer_size >= s->probesize || sti->probe_packets <= 0; if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) { @@ -544,13 +544,13 @@ FF_ENABLE_DEPRECATION_WARNINGS if (pktl) { AVStream *const st = s->streams[pktl->pkt.stream_index]; - if (si->raw_packet_buffer_remaining_size <= 0) + if (si->raw_packet_buffer_size >= s->probesize) if ((err = probe_codec(s, st, NULL)) < 0) return err; if (ffstream(st)->request_probe <= 0) { avpriv_packet_list_get(&si->raw_packet_buffer, &si->raw_packet_buffer_end, pkt); - si->raw_packet_buffer_remaining_size += pkt->size; + si->raw_packet_buffer_size -= pkt->size; return 0; } } @@ -631,7 +631,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return err; } pkt1 = &si->raw_packet_buffer_end->pkt; - si->raw_packet_buffer_remaining_size -= pkt1->size; + si->raw_packet_buffer_size += pkt1->size; if ((err = probe_codec(s, st, pkt1)) < 0) return err; |