Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
892eae20
Commit
892eae20
authored
Jun 02, 2024
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/asubprocess: move subprocess frame processing to update_state
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
511b83cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
af_asubprocess.c
libavfilter/af_asubprocess.c
+9
-7
No files found.
libavfilter/af_asubprocess.c
View file @
892eae20
...
...
@@ -236,6 +236,8 @@ sp_read(SP *sp, char *buffer, size_t count)
}
}
static
int
try_read_frame
(
AVFilterContext
*
ctx
);
static
int
update_state
(
AVFilterContext
*
ctx
)
{
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
...
...
@@ -320,6 +322,7 @@ static int update_state(AVFilterContext *ctx)
}
}
if
(
s
->
state
==
STATE_IN_DATA_CHUNK
)
{
int
ret
;
int
bytes_per_sample
=
s
->
out_bit_depth
/
8
*
outlink
->
ch_layout
.
nb_channels
;
size_t
expect_bytes
=
(
s
->
nb_input_samples
-
s
->
nb_output_samples
)
*
bytes_per_sample
;
if
((
s
->
nb_input_samples
*
bytes_per_sample
)
%
2
)
// padding byte for odd length input
...
...
@@ -328,6 +331,11 @@ static int update_state(AVFilterContext *ctx)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Subprocess produced more output data than expected.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
do
{
ret
=
try_read_frame
(
ctx
);
if
(
ret
<
0
)
return
ret
;
}
while
(
ret
>
0
);
}
return
0
;
}
...
...
@@ -586,6 +594,7 @@ static int write_frame(AVFilterContext *ctx, ASubProcessContext *s, AVFilterLink
return
AVERROR
(
ENOMEM
);
}
av_frame_copy_props
(
out
,
in
);
// TODO: LEAK
}
ff_framequeue_add
(
&
s
->
frame_queue
,
out
);
return
ret
;
...
...
@@ -639,10 +648,6 @@ static int activate(AVFilterContext *ctx)
FF_FILTER_FORWARD_STATUS_BACK
(
outlink
,
inlink
);
ret
=
try_read_frame
(
ctx
);
if
(
ret
!=
0
)
return
ret
;
ret
=
ff_inlink_consume_frame
(
inlink
,
&
in
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -666,9 +671,6 @@ static int activate(AVFilterContext *ctx)
return
ret
;
}
}
ret
=
try_read_frame
(
ctx
);
if
(
ret
!=
0
)
return
ret
;
if
(
s
->
eof
)
{
if
(
s
->
state
!=
STATE_IN_DATA_CHUNK
)
{
...
...
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