]> code.ossystems Code Review - openembedded-core.git/blob
ea4aa222b3d645329e847b7739b10ab5eaeb997c
[openembedded-core.git] /
1 gst-ffmpeg: lavf: compute probe buffer size more reliably.
2
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.
6
7 Fix trac ticket #1991.
8 (cherry picked from commit 03847eb8259291b4ff1bd840bd779d0699d71f96)
9
10 Conflicts:
11         libavformat/utils.c
12
13 Upstream-Status: Backport
14
15 Signed-off-by: Yue Tao <yue.tao@windriver.com>
16
17 ---
18  libavformat/utils.c |    4 ++--
19  1 files changed, 2 insertions(+), 2 deletions(-)
20
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,
26  {
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;
31  
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,
35              score = 0;
36              ret = 0;            /* error was end of file, nothing read */
37          }
38 -        pd.buf_size += ret;
39 +        pd.buf_size = buf_offset += ret;
40          pd.buf = &buf[offset];
41  
42          memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE);
43 -- 
44 1.7.5.4
45