Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
5d5b0bbc
Commit
5d5b0bbc
authored
May 01, 2020
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/oggdec: Factor buffer reallocation out
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
3c740f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
oggdec.c
libavformat/oggdec.c
+17
-8
No files found.
libavformat/oggdec.c
View file @
5d5b0bbc
...
...
@@ -297,6 +297,20 @@ static int data_packets_seen(const struct ogg *ogg)
return
0
;
}
static
int
buf_realloc
(
struct
ogg_stream
*
os
,
int
size
)
{
/* Even if invalid guarantee there's enough memory to read the page */
if
(
os
->
bufsize
-
os
->
bufpos
<
size
)
{
uint8_t
*
nb
=
av_realloc
(
os
->
buf
,
2
*
os
->
bufsize
+
AV_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
nb
)
return
AVERROR
(
ENOMEM
);
os
->
buf
=
nb
;
os
->
bufsize
*=
2
;
}
return
0
;
}
static
int
ogg_read_page
(
AVFormatContext
*
s
,
int
*
sid
,
int
probing
)
{
AVIOContext
*
bc
=
s
->
pb
;
...
...
@@ -378,14 +392,9 @@ static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
if
(
idx
>=
0
)
{
os
=
ogg
->
streams
+
idx
;
/* Even if invalid guarantee there's enough memory to read the page */
if
(
os
->
bufsize
-
os
->
bufpos
<
size
)
{
uint8_t
*
nb
=
av_realloc
(
os
->
buf
,
2
*
os
->
bufsize
+
AV_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
nb
)
return
AVERROR
(
ENOMEM
);
os
->
buf
=
nb
;
os
->
bufsize
*=
2
;
}
ret
=
buf_realloc
(
os
,
size
);
if
(
ret
<
0
)
return
ret
;
readout_buf
=
os
->
buf
+
os
->
bufpos
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment