From 02a958de663ec1069323a7398a879d8bf7c59c97 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie <fcvlcdev@free.fr> Date: Tue, 3 Oct 2017 15:01:17 +0200 Subject: [PATCH] codec: videotoolbox: don't set directly extradata in decoder conf Signed-off-by: Thomas Guillem <thomas@gllm.fr> --- modules/codec/videotoolbox.m | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m index 1ad3d3c983c9..8200d59ff564 100644 --- a/modules/codec/videotoolbox.m +++ b/modules/codec/videotoolbox.m @@ -551,11 +551,8 @@ static CMVideoCodecType CodecPrecheck(decoder_t *p_dec) static CFMutableDictionaryRef CreateSessionDescriptionFormat(decoder_t *p_dec, unsigned i_sar_num, - unsigned i_sar_den, - CFMutableDictionaryRef extradataInfo) + unsigned i_sar_den) { - assert(extradataInfo != nil); - CFMutableDictionaryRef decoderConfiguration = cfdict_create(2); if (decoderConfiguration == NULL) return nil; @@ -567,10 +564,6 @@ static CFMutableDictionaryRef CreateSessionDescriptionFormat(decoder_t *p_dec, kCVImageBufferChromaLocationTopFieldKey, kCVImageBufferChromaLocation_Left); - CFDictionarySetValue(decoderConfiguration, - kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, - extradataInfo); - /* pixel aspect ratio */ CFMutableDictionaryRef pixelaspectratio = cfdict_create(2); if(pixelaspectratio == NULL) @@ -639,9 +632,12 @@ static bool VideoToolboxNeedsToRestartH264(decoder_t *p_dec, bool b_ret = true; CFMutableDictionaryRef decoderConfiguration = - CreateSessionDescriptionFormat(p_dec, sarn, sard, extradataInfo); + CreateSessionDescriptionFormat(p_dec, sarn, sard); if (decoderConfiguration != nil) { + CFDictionarySetValue(decoderConfiguration, + kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, + extradataInfo); CMFormatDescriptionRef newvideoFormatDesc; /* create new video format description */ OSStatus status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault, @@ -674,14 +670,20 @@ static int StartVideoToolbox(decoder_t *p_dec) CFMutableDictionaryRef decoderConfiguration = CreateSessionDescriptionFormat(p_dec, p_dec->fmt_out.video.i_sar_num, - p_dec->fmt_out.video.i_sar_den, - p_sys->extradataInfo); + p_dec->fmt_out.video.i_sar_den); if(decoderConfiguration == nil) { CFRelease(destinationPixelBufferAttributes); return VLC_EGENERIC; } + if(p_sys->extradataInfo) + { + CFDictionarySetValue(decoderConfiguration, + kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, + p_sys->extradataInfo); + } + /* create video format description */ OSStatus status = CMVideoFormatDescriptionCreate( kCFAllocatorDefault, -- GitLab