Changeset 279101 in webkit
- Timestamp:
- Jun 21, 2021, 7:15:51 PM (5 years ago)
- Location:
- trunk/Source/ThirdParty/libwebrtc
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Source/webrtc/sdk/WebKit/WebKitDecoder.h (modified) (4 diffs)
-
Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp (modified) (3 diffs)
-
Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/libwebrtc/ChangeLog
r279065 r279101 1 2021-06-21 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] libwebrtc CMBaseClass objects need alignment fixup 4 https://bugs.webkit.org/show_bug.cgi?id=227137 5 <rdar://problem/79464124> 6 7 Reviewed by Youenn Fablet. 8 9 * Source/webrtc/sdk/WebKit/WebKitDecoder.h: Define CMBASE_OBJECT_NEEDS_ALIGNMENT. 10 11 * Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp: 12 (webrtc::createWebKitVP8Decoder): Add padding to the CMBaseClass object on Mac and 13 Mac Catalyst when building for x86_64 so function pointers are naturally aligned. 14 Add static_asserts to ensure alignment and sizes are correct. 15 16 * Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp: 17 (webrtc::createWebKitVP9Decoder): Ditto. 18 1 19 2021-06-21 Philippe Normand <pnormand@igalia.com> 2 20 -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h
r278701 r279101 1 1 /* 2 * Copyright (C) 2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include <Availability.h> 28 29 #include "WebKitUtilities.h" 29 30 #include "api/video/encoded_image.h" … … 34 35 35 36 namespace webrtc { 37 38 #if (TARGET_OS_OSX || TARGET_OS_MACCATALYST) && TARGET_CPU_X86_64 39 #define CMBASE_OBJECT_NEEDS_ALIGNMENT 1 40 #else 41 #define CMBASE_OBJECT_NEEDS_ALIGNMENT 0 42 #endif 36 43 37 44 struct SdpVideoFormat; … … 48 55 std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265, WebKitVP9, WebKitVP9VTB); 49 56 void videoDecoderTaskComplete(void* callback, uint32_t timeStamp, CVPixelBufferRef, uint32_t timeStampRTP); 50 51 57 52 58 using LocalDecoder = void*; -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp
r279023 r279101 1 1 /* 2 * Copyright (C) 2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 49 49 static CFStringRef copyVP8DecoderDebugDescription(CMBaseObjectRef); 50 50 51 static const CMBaseClass WebKitVP8Decoder_BaseClass = 52 { 53 kCMBaseObject_ClassVersion_1, 54 sizeof(WebKitVP8Decoder), 55 nullptr, // Comparison by pointer equality 56 invalidateVP8Decoder, 57 finalizeVP8Decoder, 58 copyVP8DecoderDebugDescription, 59 nullptr, // CopyProperty 60 nullptr, // SetProperty 61 nullptr, 62 nullptr 63 }; 51 #if defined(CMBASE_OBJECT_NEEDS_ALIGNMENT) && CMBASE_OBJECT_NEEDS_ALIGNMENT 52 constexpr size_t padSize = 4; 53 #else 54 constexpr size_t padSize = 0; 55 #endif 56 57 #pragma pack(push, 4) 58 struct DecoderClass { 59 uint8_t pad[padSize]; 60 CMBaseClass alignedClass; 61 }; 62 63 static const DecoderClass WebKitVP8Decoder_BaseClass { 64 { }, 65 { 66 kCMBaseObject_ClassVersion_1, 67 sizeof(WebKitVP8Decoder), 68 nullptr, // Comparison by pointer equality 69 invalidateVP8Decoder, 70 finalizeVP8Decoder, 71 copyVP8DecoderDebugDescription, 72 nullptr, // CopyProperty 73 nullptr, // SetProperty 74 nullptr, 75 nullptr 76 } 77 }; 78 #pragma pack(pop) 79 80 #if defined(CMBASE_OBJECT_NEEDS_ALIGNMENT) && CMBASE_OBJECT_NEEDS_ALIGNMENT 81 static_assert(sizeof(WebKitVP8Decoder_BaseClass.alignedClass.version) == sizeof(uint32_t), "CMBaseClass fixup is required!"); 82 #else 83 static_assert(sizeof(WebKitVP8Decoder_BaseClass.alignedClass.version) == sizeof(uintptr_t), "CMBaseClass fixup is not required!"); 84 #endif 85 static_assert(offsetof(DecoderClass, alignedClass) == padSize, "CMBaseClass offset is incorrect!"); 86 static_assert(alignof(DecoderClass) == 4, "CMBaseClass must have 4 byte alignment"); 64 87 65 88 static OSStatus startVP8DecoderSession(VTVideoDecoderRef, VTVideoDecoderSession, CMVideoFormatDescriptionRef); … … 83 106 static const VTVideoDecoderVTable WebKitVP8DecoderVTable = 84 107 { 85 { nullptr, &WebKitVP8Decoder_BaseClass },108 { nullptr, &WebKitVP8Decoder_BaseClass.alignedClass }, 86 109 &WebKitVP8Decoder_VideoDecoderClass 87 110 }; -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp
r279023 r279101 1 1 /* 2 * Copyright (C) 2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 49 49 static CFStringRef copyVP9DecoderDebugDescription(CMBaseObjectRef); 50 50 51 static const CMBaseClass WebKitVP9Decoder_BaseClass = 52 { 53 kCMBaseObject_ClassVersion_1, 54 sizeof(WebKitVP9Decoder), 55 nullptr, // Comparison by pointer equality 56 invalidateVP9Decoder, 57 finalizeVP9Decoder, 58 copyVP9DecoderDebugDescription, 59 nullptr, // CopyProperty 60 nullptr, // SetProperty 61 nullptr, 62 nullptr 63 }; 51 #if defined(CMBASE_OBJECT_NEEDS_ALIGNMENT) && CMBASE_OBJECT_NEEDS_ALIGNMENT 52 constexpr size_t padSize = 4; 53 #else 54 constexpr size_t padSize = 0; 55 #endif 56 57 #pragma pack(push, 4) 58 struct DecoderClass { 59 uint8_t pad[padSize]; 60 CMBaseClass alignedClass; 61 }; 62 63 static const DecoderClass WebKitVP9Decoder_BaseClass { 64 { }, 65 { 66 kCMBaseObject_ClassVersion_1, 67 sizeof(WebKitVP9Decoder), 68 nullptr, // Comparison by pointer equality 69 invalidateVP9Decoder, 70 finalizeVP9Decoder, 71 copyVP9DecoderDebugDescription, 72 nullptr, // CopyProperty 73 nullptr, // SetProperty 74 nullptr, 75 nullptr 76 } 77 }; 78 #pragma pack(pop) 79 80 #if defined(CMBASE_OBJECT_NEEDS_ALIGNMENT) && CMBASE_OBJECT_NEEDS_ALIGNMENT 81 static_assert(sizeof(WebKitVP9Decoder_BaseClass.alignedClass.version) == sizeof(uint32_t), "CMBaseClass fixup is required!"); 82 #else 83 static_assert(sizeof(WebKitVP9Decoder_BaseClass.alignedClass.version) == sizeof(uintptr_t), "CMBaseClass fixup is not required!"); 84 #endif 85 static_assert(offsetof(DecoderClass, alignedClass) == padSize, "CMBaseClass offset is incorrect!"); 86 static_assert(alignof(DecoderClass) == 4, "CMBaseClass must have 4 byte alignment"); 64 87 65 88 static OSStatus startVP9DecoderSession(VTVideoDecoderRef, VTVideoDecoderSession, CMVideoFormatDescriptionRef); … … 83 106 static const VTVideoDecoderVTable WebKitVP9DecoderVTable = 84 107 { 85 { nullptr, &WebKitVP9Decoder_BaseClass },108 { nullptr, &WebKitVP9Decoder_BaseClass.alignedClass }, 86 109 &WebKitVP9Decoder_VideoDecoderClass 87 110 };
Note:
See TracChangeset
for help on using the changeset viewer.