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
0ff5567a
Commit
0ff5567a
authored
Dec 23, 2016
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/buffersrc: push the frame deeper if requested.
Reduce peak memory consumption with ffmpeg in certain cases.
parent
3b64e3ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
buffersrc.c
libavfilter/buffersrc.c
+25
-0
No files found.
libavfilter/buffersrc.c
View file @
0ff5567a
...
@@ -173,6 +173,20 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
...
@@ -173,6 +173,20 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
return
ret
;
return
ret
;
}
}
static
int
push_frame
(
AVFilterGraph
*
graph
)
{
int
ret
;
while
(
1
)
{
ret
=
ff_filter_graph_run_once
(
graph
);
if
(
ret
==
AVERROR
(
EAGAIN
))
break
;
if
(
ret
<
0
)
return
ret
;
}
return
0
;
}
static
int
av_buffersrc_add_frame_internal
(
AVFilterContext
*
ctx
,
static
int
av_buffersrc_add_frame_internal
(
AVFilterContext
*
ctx
,
AVFrame
*
frame
,
int
flags
)
AVFrame
*
frame
,
int
flags
)
{
{
...
@@ -185,6 +199,11 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
...
@@ -185,6 +199,11 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
if
(
!
frame
)
{
if
(
!
frame
)
{
s
->
eof
=
1
;
s
->
eof
=
1
;
ff_avfilter_link_set_in_status
(
ctx
->
outputs
[
0
],
AVERROR_EOF
,
AV_NOPTS_VALUE
);
ff_avfilter_link_set_in_status
(
ctx
->
outputs
[
0
],
AVERROR_EOF
,
AV_NOPTS_VALUE
);
if
((
flags
&
AV_BUFFERSRC_FLAG_PUSH
))
{
ret
=
push_frame
(
ctx
->
graph
);
if
(
ret
<
0
)
return
ret
;
}
return
0
;
return
0
;
}
else
if
(
s
->
eof
)
}
else
if
(
s
->
eof
)
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
...
@@ -239,6 +258,12 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
...
@@ -239,6 +258,12 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
if
((
ret
=
ctx
->
output_pads
[
0
].
request_frame
(
ctx
->
outputs
[
0
]))
<
0
)
if
((
ret
=
ctx
->
output_pads
[
0
].
request_frame
(
ctx
->
outputs
[
0
]))
<
0
)
return
ret
;
return
ret
;
if
((
flags
&
AV_BUFFERSRC_FLAG_PUSH
))
{
ret
=
push_frame
(
ctx
->
graph
);
if
(
ret
<
0
)
return
ret
;
}
return
0
;
return
0
;
}
}
...
...
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