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
8daca769
Commit
8daca769
authored
Apr 14, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_headphone: do not output invalid samples when flushing
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
01170e9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
af_headphone.c
libavfilter/af_headphone.c
+12
-4
No files found.
libavfilter/af_headphone.c
View file @
8daca769
...
...
@@ -349,7 +349,7 @@ static int read_ir(AVFilterLink *inlink, AVFrame *frame)
return
0
;
}
static
int
headphone_frame
(
HeadphoneContext
*
s
,
AVFilterLink
*
outlink
)
static
int
headphone_frame
(
HeadphoneContext
*
s
,
AVFilterLink
*
outlink
,
int
max_nb_samples
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
AVFrame
*
in
=
s
->
in
[
0
].
frame
;
...
...
@@ -383,6 +383,7 @@ static int headphone_frame(HeadphoneContext *s, AVFilterLink *outlink)
n_clippings
[
0
]
+
n_clippings
[
1
],
out
->
nb_samples
*
2
);
}
out
->
nb_samples
=
max_nb_samples
;
return
ff_filter_frame
(
outlink
,
out
);
}
...
...
@@ -593,7 +594,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
if
(
s
->
have_hrirs
)
{
while
(
av_audio_fifo_size
(
s
->
in
[
0
].
fifo
)
>=
s
->
size
)
{
ret
=
headphone_frame
(
s
,
outlink
);
ret
=
headphone_frame
(
s
,
outlink
,
s
->
size
);
if
(
ret
<
0
)
return
ret
;
}
...
...
@@ -745,13 +746,20 @@ static int request_frame(AVFilterLink *outlink)
ret
=
ff_request_frame
(
ctx
->
inputs
[
0
]);
if
(
ret
==
AVERROR_EOF
&&
av_audio_fifo_size
(
s
->
in
[
0
].
fifo
)
>
0
&&
s
->
have_hrirs
)
{
AVFrame
*
in
=
ff_get_audio_buffer
(
outlink
,
s
->
size
);
int
nb_samples
=
av_audio_fifo_size
(
s
->
in
[
0
].
fifo
);
AVFrame
*
in
=
ff_get_audio_buffer
(
outlink
,
s
->
size
-
nb_samples
);
av_samples_set_silence
(
in
->
extended_data
,
0
,
in
->
nb_samples
,
outlink
->
channels
,
outlink
->
format
);
ret
=
av_audio_fifo_write
(
s
->
in
[
0
].
fifo
,
(
void
**
)
in
->
extended_data
,
in
->
nb_samples
);
if
(
ret
<
0
)
return
ret
;
ret
=
headphone_frame
(
s
,
outlink
);
ret
=
headphone_frame
(
s
,
outlink
,
nb_samples
);
av_audio_fifo_drain
(
s
->
in
[
0
].
fifo
,
av_audio_fifo_size
(
s
->
in
[
0
].
fifo
));
}
...
...
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