Commit 272dd437 authored by Rick Kern's avatar Rick Kern Committed by wm4

lavc/videotoolboxenc: Handle out-of-memory and fix memory leak

Signed-off-by: 's avatarRick Kern <kernrj@gmail.com>
parent 2fbf3938
...@@ -706,9 +706,14 @@ static av_cold int vtenc_init(AVCodecContext *avctx) ...@@ -706,9 +706,14 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
CFNumberRef interval = CFNumberCreate(kCFAllocatorDefault, CFNumberRef interval = CFNumberCreate(kCFAllocatorDefault,
kCFNumberIntType, kCFNumberIntType,
&avctx->gop_size); &avctx->gop_size);
if (!interval) {
return AVERROR(ENOMEM);
}
status = VTSessionSetProperty(vtctx->session, status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_MaxKeyFrameInterval, kVTCompressionPropertyKey_MaxKeyFrameInterval,
interval); interval);
CFRelease(interval);
if (status) { if (status) {
av_log(avctx, AV_LOG_ERROR, "Error setting 'max key-frame interval' property: %d\n", status); av_log(avctx, AV_LOG_ERROR, "Error setting 'max key-frame interval' property: %d\n", status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment