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
6ce02126
Commit
6ce02126
authored
Sep 30, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_rubberband: flush only if there is something available
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
3178931a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
af_rubberband.c
libavfilter/af_rubberband.c
+21
-19
No files found.
libavfilter/af_rubberband.c
View file @
6ce02126
...
...
@@ -175,29 +175,31 @@ static int request_frame(AVFilterLink *outlink)
ret
=
ff_request_frame
(
ctx
->
inputs
[
0
]);
if
(
ret
==
AVERROR_EOF
&&
!
s
->
flushed
)
{
AVFrame
*
out
=
ff_get_audio_buffer
(
inlink
,
1
);
int
nb_samples
;
if
(
rubberband_available
(
s
->
rbs
)
>
0
)
{
AVFrame
*
out
=
ff_get_audio_buffer
(
inlink
,
1
);
int
nb_samples
;
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
rubberband_process
(
s
->
rbs
,
(
const
float
*
const
*
)
out
->
data
,
1
,
1
);
av_frame_free
(
&
out
);
s
->
flushed
=
1
;
nb_samples
=
rubberband_available
(
s
->
rbs
);
if
(
nb_samples
>
0
)
{
out
=
ff_get_audio_buffer
(
inlink
,
nb_samples
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
out
->
pts
=
av_rescale_q
(
s
->
nb_samples_out
,
(
AVRational
){
1
,
outlink
->
sample_rate
},
outlink
->
time_base
);
nb_samples
=
rubberband_retrieve
(
s
->
rbs
,
(
float
*
const
*
)
out
->
data
,
nb_samples
);
out
->
nb_samples
=
nb_samples
;
ret
=
ff_filter_frame
(
outlink
,
out
);
s
->
nb_samples_out
+=
nb_samples
;
rubberband_process
(
s
->
rbs
,
(
const
float
*
const
*
)
out
->
data
,
1
,
1
);
av_frame_free
(
&
out
);
nb_samples
=
rubberband_available
(
s
->
rbs
);
if
(
nb_samples
>
0
)
{
out
=
ff_get_audio_buffer
(
inlink
,
nb_samples
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
out
->
pts
=
av_rescale_q
(
s
->
nb_samples_out
,
(
AVRational
){
1
,
outlink
->
sample_rate
},
outlink
->
time_base
);
nb_samples
=
rubberband_retrieve
(
s
->
rbs
,
(
float
*
const
*
)
out
->
data
,
nb_samples
);
out
->
nb_samples
=
nb_samples
;
ret
=
ff_filter_frame
(
outlink
,
out
);
s
->
nb_samples_out
+=
nb_samples
;
}
}
s
->
flushed
=
1
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"nb_samples_in %"
PRId64
" nb_samples_out %"
PRId64
"
\n
"
,
s
->
nb_samples_in
,
s
->
nb_samples_out
);
}
...
...
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