[vlc-commits] codec: videotoolbox: don't set directly extradata in decoder conf

Francois Cartegnie git at videolan.org
Fri Nov 24 13:12:01 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct  3 15:01:17 2017 +0200| [02a958de663ec1069323a7398a879d8bf7c59c97] | committer: Thomas Guillem

codec: videotoolbox: don't set directly extradata in decoder conf

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02a958de663ec1069323a7398a879d8bf7c59c97
---

 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 1ad3d3c983..8200d59ff5 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,



More information about the vlc-commits mailing list