diff mbox series

[FFmpeg-devel,1/3] lavf/format: handle max probe buffer sizes <2048

Message ID 20200522054200.74203-1-rcombs@rcombs.me
State New
Headers show
Series [FFmpeg-devel,1/3] lavf/format: handle max probe buffer sizes <2048
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Ridley Combs May 22, 2020, 5:41 a.m. UTC
This can be useful in chained demuxers, where the header size is known.
---
 libavformat/format.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/format.c b/libavformat/format.c
index c47490c8eb..7309b0019b 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -231,11 +231,6 @@  int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt,
 
     if (!max_probe_size)
         max_probe_size = PROBE_BUF_MAX;
-    else if (max_probe_size < PROBE_BUF_MIN) {
-        av_log(logctx, AV_LOG_ERROR,
-               "Specified probe size value %u cannot be < %u\n", max_probe_size, PROBE_BUF_MIN);
-        return AVERROR(EINVAL);
-    }
 
     if (offset >= max_probe_size)
         return AVERROR(EINVAL);
@@ -251,7 +246,7 @@  int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt,
         }
     }
 
-    for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt;
+    for (probe_size = FFMIN(PROBE_BUF_MIN, max_probe_size); probe_size <= max_probe_size && !*fmt;
          probe_size = FFMIN(probe_size << 1,
                             FFMAX(max_probe_size, probe_size + 1))) {
         score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;