1 gst-ffmpeg: lavf: compute probe buffer size more reliably.
3 The previous code computes the offset by reversing the growth
4 of the allocated buffer size: it is complex and did lead to
5 inconsistencies when the size limit is reached.
8 (cherry picked from commit 03847eb8259291b4ff1bd840bd779d0699d71f96)
13 Upstream-Status: Backport
15 Signed-off-by: Yue Tao <yue.tao@windriver.com>
18 libavformat/utils.c | 4 ++--
19 1 files changed, 2 insertions(+), 2 deletions(-)
21 diff --git a/libavformat/utils.c b/libavformat/utils.c
22 index 7940037..be73c4a 100644
23 --- a/gst-libs/ext/libav/libavformat/utils.c
24 +++ b/gst-libs/ext/libav/libavformat/utils.c
25 @@ -459,7 +459,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
27 AVProbeData pd = { filename ? filename : "", NULL, -offset };
28 unsigned char *buf = NULL;
29 - int ret = 0, probe_size;
30 + int ret = 0, probe_size, buf_offset = 0;
32 if (!max_probe_size) {
33 max_probe_size = PROBE_BUF_MAX;
34 @@ -499,7 +499,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
36 ret = 0; /* error was end of file, nothing read */
39 + pd.buf_size = buf_offset += ret;
40 pd.buf = &buf[offset];
42 memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE);