[vlc-devel] [PATCH v2] videotoolbox: set iosurface property

Alexandre Janniaux ajanni at videolabs.io
Tue Jan 26 08:29:07 UTC 2021


The kCVPixelBufferIOSSurfaceProperties is supposed to be mandatory for
baking the buffer with an iosurface.

See https://developer.apple.com/library/archive/qa/qa1781/_index.html
---
 modules/codec/videotoolbox.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/codec/videotoolbox.c b/modules/codec/videotoolbox.c
index 9224989cb7..de1a3483b6 100644
--- a/modules/codec/videotoolbox.c
+++ b/modules/codec/videotoolbox.c
@@ -1205,6 +1205,16 @@ static int StartVideoToolbox(decoder_t *p_dec)
                          kCVPixelBufferOpenGLESCompatibilityKey,
                          kCFBooleanTrue);
 #endif
+    CFMutableDictionaryRef iosurfaceProperties = cfdict_create(0);
+    if (iosurfaceProperties == NULL)
+    {
+        CFRelease(destinationPixelBufferAttributes);
+        CFRelease(decoderConfiguration);
+        return VLC_ENOMEM;
+    }
+    CFDictionarySetValue(destinationPixelBufferAttributes,
+                         kCVPixelBufferIOSurfacePropertiesKey,
+                         iosurfaceProperties);
 
     cfdict_set_int32(destinationPixelBufferAttributes,
                      kCVPixelBufferWidthKey, p_dec->fmt_out.video.i_visible_width);
@@ -1235,6 +1245,7 @@ static int StartVideoToolbox(decoder_t *p_dec)
                                           decoderConfiguration,
                                           destinationPixelBufferAttributes,
                                           &decoderCallbackRecord, &p_sys->session);
+    CFRelease(iosurfaceProperties);
     CFRelease(decoderConfiguration);
     CFRelease(destinationPixelBufferAttributes);
 
-- 
2.30.0



More information about the vlc-devel mailing list