소스 검색

mac-videtoolbox: Use correct size for system representation CFStrings

PatTheMav 3 년 전
부모
커밋
097e9ccecf
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      plugins/mac-videotoolbox/encoder.c

+ 5 - 4
plugins/mac-videotoolbox/encoder.c

@@ -1383,10 +1383,11 @@ bool obs_module_load(void)
 		CFDictionaryRef encoder_dict =
 		CFDictionaryRef encoder_dict =
 			CFArrayGetValueAtIndex(encoder_list, i);
 			CFArrayGetValueAtIndex(encoder_list, i);
 
 
-#define VT_DICTSTR(key, name)                                             \
-	CFStringRef name##_ref = CFDictionaryGetValue(encoder_dict, key); \
-	CFIndex name##_len = CFStringGetLength(name##_ref);               \
-	char *name = bzalloc(name##_len + 1);                             \
+#define VT_DICTSTR(key, name)                                                 \
+	CFStringRef name##_ref = CFDictionaryGetValue(encoder_dict, key);     \
+	CFIndex name##_len =                                                  \
+		CFStringGetMaximumSizeOfFileSystemRepresentation(name##_ref); \
+	char *name = bzalloc(name##_len + 1);                                 \
 	CFStringGetFileSystemRepresentation(name##_ref, name, name##_len);
 	CFStringGetFileSystemRepresentation(name##_ref, name, name##_len);
 
 
 		CMVideoCodecType codec_type = 0;
 		CMVideoCodecType codec_type = 0;