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
a2dbd177
Commit
a2dbd177
authored
Feb 27, 2022
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_dynaudnorm: allocate new frame instead of making it writable
Later case does not use frame pool at all.
parent
a9124a75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
af_dynaudnorm.c
libavfilter/af_dynaudnorm.c
+27
-8
No files found.
libavfilter/af_dynaudnorm.c
View file @
a2dbd177
...
...
@@ -647,23 +647,42 @@ static void perform_compression(DynamicAudioNormalizerContext *s, AVFrame *frame
}
}
static
int
analyze_frame
(
DynamicAudioNormalizerContext
*
s
,
AVF
rame
*
frame
)
static
int
analyze_frame
(
DynamicAudioNormalizerContext
*
s
,
AVF
ilterLink
*
outlink
,
AVFrame
*
*
frame
)
{
if
(
s
->
dc_correction
||
s
->
compress_factor
>
DBL_EPSILON
)
{
int
ret
;
if
((
ret
=
av_frame_make_writable
(
frame
))
<
0
)
return
ret
;
if
(
!
av_frame_is_writable
(
*
frame
))
{
AVFrame
*
out
=
ff_get_audio_buffer
(
outlink
,
(
*
frame
)
->
nb_samples
);
if
(
!
out
)
{
av_frame_free
(
frame
);
return
AVERROR
(
ENOMEM
);
}
ret
=
av_frame_copy_props
(
out
,
*
frame
);
if
(
ret
<
0
)
{
av_frame_free
(
&
out
);
return
ret
;
}
ret
=
av_frame_copy
(
out
,
*
frame
);
if
(
ret
<
0
)
{
av_frame_free
(
&
out
);
return
ret
;
}
av_frame_free
(
frame
);
*
frame
=
out
;
}
}
if
(
s
->
dc_correction
)
perform_dc_correction
(
s
,
frame
);
perform_dc_correction
(
s
,
*
frame
);
if
(
s
->
compress_factor
>
DBL_EPSILON
)
perform_compression
(
s
,
frame
);
perform_compression
(
s
,
*
frame
);
if
(
s
->
channels_coupled
)
{
const
local_gain
gain
=
get_max_local_gain
(
s
,
frame
,
-
1
);
const
local_gain
gain
=
get_max_local_gain
(
s
,
*
frame
,
-
1
);
int
c
;
for
(
c
=
0
;
c
<
s
->
channels
;
c
++
)
...
...
@@ -672,7 +691,7 @@ static int analyze_frame(DynamicAudioNormalizerContext *s, AVFrame *frame)
int
c
;
for
(
c
=
0
;
c
<
s
->
channels
;
c
++
)
update_gain_history
(
s
,
c
,
get_max_local_gain
(
s
,
frame
,
c
));
update_gain_history
(
s
,
c
,
get_max_local_gain
(
s
,
*
frame
,
c
));
}
return
0
;
...
...
@@ -740,7 +759,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ret
;
}
ret
=
analyze_frame
(
s
,
in
);
ret
=
analyze_frame
(
s
,
outlink
,
&
in
);
if
(
ret
<
0
)
return
ret
;
if
(
!
s
->
eof
)
{
...
...
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