Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
x264
Commits
cbb90707
Commit
cbb90707
authored
Jul 24, 2012
by
Kieran Kunhya
Committed by
Fiona Glaser
Jul 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Free user supplied data when deleting a frame
This eliminates a memory leak when calling x264_encoder_close.
parent
3d03b619
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
common/frame.c
common/frame.c
+10
-0
encoder/encoder.c
encoder/encoder.c
+16
-2
No files found.
common/frame.c
View file @
cbb90707
...
...
@@ -300,6 +300,16 @@ void x264_frame_delete( x264_frame_t *frame )
x264_free
(
frame
->
mv16x16
-
1
);
x264_free
(
frame
->
ref
[
0
]
);
x264_free
(
frame
->
ref
[
1
]
);
if
(
frame
->
param
&&
frame
->
param
->
param_free
)
frame
->
param
->
param_free
(
frame
->
param
);
if
(
frame
->
mb_info_free
)
frame
->
mb_info_free
(
frame
->
mb_info
);
if
(
frame
->
extra_sei
.
sei_free
)
{
for
(
int
i
=
0
;
i
<
frame
->
extra_sei
.
num_payloads
;
i
++
)
frame
->
extra_sei
.
sei_free
(
frame
->
extra_sei
.
payloads
[
i
].
payload
);
frame
->
extra_sei
.
sei_free
(
frame
->
extra_sei
.
payloads
);
}
x264_pthread_mutex_destroy
(
&
frame
->
mutex
);
x264_pthread_cond_destroy
(
&
frame
->
cv
);
}
...
...
encoder/encoder.c
View file @
cbb90707
...
...
@@ -2878,7 +2878,10 @@ int x264_encoder_encode( x264_t *h,
{
x264_encoder_reconfig
(
h
,
h
->
fenc
->
param
);
if
(
h
->
fenc
->
param
->
param_free
)
{
h
->
fenc
->
param
->
param_free
(
h
->
fenc
->
param
);
h
->
fenc
->
param
=
NULL
;
}
}
// ok to call this before encoding any frames, since the initial values of fdec have b_kept_as_ref=0
...
...
@@ -3098,12 +3101,19 @@ int x264_encoder_encode( x264_t *h,
if
(
x264_nal_end
(
h
)
)
return
-
1
;
overhead
+=
h
->
out
.
nal
[
h
->
out
.
i_nal
-
1
].
i_payload
+
NALU_OVERHEAD
-
(
h
->
param
.
b_annexb
&&
h
->
out
.
i_nal
-
1
);
if
(
h
->
fenc
->
extra_sei
.
sei_free
&&
h
->
fenc
->
extra_sei
.
payloads
[
i
].
payload
)
if
(
h
->
fenc
->
extra_sei
.
sei_free
)
{
h
->
fenc
->
extra_sei
.
sei_free
(
h
->
fenc
->
extra_sei
.
payloads
[
i
].
payload
);
h
->
fenc
->
extra_sei
.
payloads
[
i
].
payload
=
NULL
;
}
}
if
(
h
->
fenc
->
extra_sei
.
sei_free
&&
h
->
fenc
->
extra_sei
.
payloads
)
if
(
h
->
fenc
->
extra_sei
.
sei_free
)
{
h
->
fenc
->
extra_sei
.
sei_free
(
h
->
fenc
->
extra_sei
.
payloads
);
h
->
fenc
->
extra_sei
.
payloads
=
NULL
;
h
->
fenc
->
extra_sei
.
sei_free
=
NULL
;
}
if
(
h
->
fenc
->
b_keyframe
)
{
...
...
@@ -3232,7 +3242,11 @@ static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
x264_emms
();
if
(
h
->
fenc
->
mb_info_free
)
{
h
->
fenc
->
mb_info_free
(
h
->
fenc
->
mb_info
);
h
->
fenc
->
mb_info
=
NULL
;
h
->
fenc
->
mb_info_free
=
NULL
;
}
/* generate buffering period sei and insert it into place */
if
(
h
->
i_thread_frames
>
1
&&
h
->
fenc
->
b_keyframe
&&
h
->
sps
->
vui
.
b_nal_hrd_parameters_present
)
...
...
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