You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -328,7 +328,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
|
|||||||
if (s->pb && !si->data_offset)
|
if (s->pb && !si->data_offset)
|
||||||
si->data_offset = avio_tell(s->pb);
|
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);
|
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;
|
|| sti->probe_packets <= 0;
|
||||||
|
|
||||||
if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
|
if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
|
||||||
@@ -544,13 +544,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
|
|
||||||
if (pktl) {
|
if (pktl) {
|
||||||
AVStream *const st = s->streams[pktl->pkt.stream_index];
|
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)
|
if ((err = probe_codec(s, st, NULL)) < 0)
|
||||||
return err;
|
return err;
|
||||||
if (ffstream(st)->request_probe <= 0) {
|
if (ffstream(st)->request_probe <= 0) {
|
||||||
avpriv_packet_list_get(&si->raw_packet_buffer,
|
avpriv_packet_list_get(&si->raw_packet_buffer,
|
||||||
&si->raw_packet_buffer_end, pkt);
|
&si->raw_packet_buffer_end, pkt);
|
||||||
si->raw_packet_buffer_remaining_size += pkt->size;
|
si->raw_packet_buffer_size -= pkt->size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,7 +631,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
pkt1 = &si->raw_packet_buffer_end->pkt;
|
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)
|
if ((err = probe_codec(s, st, pkt1)) < 0)
|
||||||
return err;
|
return err;
|
||||||
|
@@ -127,10 +127,9 @@ typedef struct FFFormatContext {
|
|||||||
*/
|
*/
|
||||||
AVPacket *pkt;
|
AVPacket *pkt;
|
||||||
/**
|
/**
|
||||||
* Remaining size available for raw_packet_buffer, in bytes.
|
* Sum of the size of packets in raw_packet_buffer, in bytes.
|
||||||
*/
|
*/
|
||||||
#define RAW_PACKET_BUFFER_SIZE 2500000
|
int raw_packet_buffer_size;
|
||||||
int raw_packet_buffer_remaining_size;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset to remap timestamps to be non-negative.
|
* Offset to remap timestamps to be non-negative.
|
||||||
|
@@ -174,7 +174,6 @@ AVFormatContext *avformat_alloc_context(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
si->offset = AV_NOPTS_VALUE;
|
si->offset = AV_NOPTS_VALUE;
|
||||||
si->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
|
|
||||||
si->shortest_end = AV_NOPTS_VALUE;
|
si->shortest_end = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@@ -303,7 +303,7 @@ void ff_flush_packet_queue(AVFormatContext *s)
|
|||||||
avpriv_packet_list_free(&si->packet_buffer, &si->packet_buffer_end);
|
avpriv_packet_list_free(&si->packet_buffer, &si->packet_buffer_end);
|
||||||
avpriv_packet_list_free(&si->raw_packet_buffer, &si->raw_packet_buffer_end);
|
avpriv_packet_list_free(&si->raw_packet_buffer, &si->raw_packet_buffer_end);
|
||||||
|
|
||||||
si->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
|
si->raw_packet_buffer_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_find_default_stream_index(AVFormatContext *s)
|
int av_find_default_stream_index(AVFormatContext *s)
|
||||||
|
Reference in New Issue
Block a user