Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
d309efd0
Commit
d309efd0
authored
Dec 08, 2016
by
François Grisez
Browse files
VideoToolboxH264Decoder: fix double free
parent
52c02e40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
20 deletions
+24
-20
src/videofilters/videotoolbox.c
src/videofilters/videotoolbox.c
+24
-20
No files found.
src/videofilters/videotoolbox.c
View file @
d309efd0
...
@@ -32,6 +32,29 @@
...
@@ -32,6 +32,29 @@
#define vth264enc_warning(fmt, ...) vth264enc_log(warning, fmt, ##__VA_ARGS__)
#define vth264enc_warning(fmt, ...) vth264enc_log(warning, fmt, ##__VA_ARGS__)
#define vth264enc_error(fmt, ...) vth264enc_log(error, fmt, ##__VA_ARGS__)
#define vth264enc_error(fmt, ...) vth264enc_log(error, fmt, ##__VA_ARGS__)
static
const
char
*
os_status_to_string
(
OSStatus
status
)
{
static
char
complete_message
[
1024
];
const
char
*
message
=
""
;
switch
(
status
)
{
case
noErr
:
message
=
"no error"
;
break
;
case
kVTPropertyNotSupportedErr
:
message
=
"property not supported"
;
break
;
case
kVTVideoDecoderMalfunctionErr
:
message
=
"decoder malfunction"
;
break
;
case
kVTInvalidSessionErr
:
message
=
"invalid session"
;
break
;
default:
break
;
}
snprintf
(
complete_message
,
sizeof
(
complete_message
),
"%s [osstatus=%d]"
,
message
,
status
);
return
complete_message
;
}
const
MSVideoConfiguration
h264_video_confs
[]
=
{
const
MSVideoConfiguration
h264_video_confs
[]
=
{
MS_VIDEO_CONF
(
1536000
,
2560000
,
SXGA_MINUS
,
25
,
2
),
MS_VIDEO_CONF
(
1536000
,
2560000
,
SXGA_MINUS
,
25
,
2
),
...
@@ -64,24 +87,6 @@ typedef struct _VTH264EncCtx {
...
@@ -64,24 +87,6 @@ typedef struct _VTH264EncCtx {
MSIFrameRequestsLimiterCtx
iframe_limiter
;
MSIFrameRequestsLimiterCtx
iframe_limiter
;
}
VTH264EncCtx
;
}
VTH264EncCtx
;
static
const
char
*
os_status_to_string
(
OSStatus
status
)
{
static
char
complete_message
[
1024
];
const
char
*
message
=
""
;
switch
(
status
)
{
case
noErr
:
message
=
"no error"
;
break
;
case
kVTPropertyNotSupportedErr
:
message
=
"property not supported"
;
break
;
default:
break
;
}
snprintf
(
complete_message
,
sizeof
(
complete_message
),
"%s [osstatus=%d]"
,
message
,
status
);
return
complete_message
;
}
static
void
h264_enc_output_cb
(
VTH264EncCtx
*
ctx
,
void
*
sourceFrameRefCon
,
OSStatus
status
,
VTEncodeInfoFlags
infoFlags
,
CMSampleBufferRef
sampleBuffer
)
{
static
void
h264_enc_output_cb
(
VTH264EncCtx
*
ctx
,
void
*
sourceFrameRefCon
,
OSStatus
status
,
VTEncodeInfoFlags
infoFlags
,
CMSampleBufferRef
sampleBuffer
)
{
MSQueue
nalu_queue
;
MSQueue
nalu_queue
;
CMBlockBufferRef
block_buffer
;
CMBlockBufferRef
block_buffer
;
...
@@ -832,8 +837,7 @@ static void h264_dec_process(MSFilter *f) {
...
@@ -832,8 +837,7 @@ static void h264_dec_process(MSFilter *f) {
status
=
VTDecompressionSessionDecodeFrame
(
ctx
->
session
,
sample
,
0
,
NULL
,
NULL
);
status
=
VTDecompressionSessionDecodeFrame
(
ctx
->
session
,
sample
,
0
,
NULL
,
NULL
);
CFRelease
(
sample
);
CFRelease
(
sample
);
if
(
status
!=
noErr
)
{
if
(
status
!=
noErr
)
{
CFRelease
(
stream
);
vth264dec_error
(
"error while passing encoded frames to the decoder: %d"
,
os_status_to_string
(
status
));
vth264dec_error
(
"error while passing encoded frames to the decoder: %d"
,
(
int
)
status
);
if
(
status
==
kVTInvalidSessionErr
)
{
if
(
status
==
kVTInvalidSessionErr
)
{
h264_dec_uninit_decoder
(
ctx
);
h264_dec_uninit_decoder
(
ctx
);
}
}
...
...
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