Title: [254590] branches/safari-609-branch/Source/WebCore/PAL
Revision
254590
Author
alanc...@apple.com
Date
2020-01-15 11:14:47 -0800 (Wed, 15 Jan 2020)

Log Message

Cherry-pick r254141. rdar://problem/58559202

    Flaky API Test: TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
    https://bugs.webkit.org/show_bug.cgi?id=194340
    <rdar://problem/50507254>

    Reviewed by Eric Carlson.

    Workaround for AVFoundation crash for OS versions prior to platform fix. This crash occurrs infrequently
    while triggering KVO due to an internal @property change. Work around the crash by disabling KVO for that
    property at runtime, by injecting a new class method +automaticallyNotifiesObserversOfSuppressesVideoLayers
    immediately after soft linking the AVFoundation library.

    * pal/cocoa/AVFoundationSoftLink.mm:
    (PAL::justReturnsNO):
    (PAL::AVFoundationLibrary):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/PAL/ChangeLog (254589 => 254590)


--- branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-01-15 19:14:45 UTC (rev 254589)
+++ branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-01-15 19:14:47 UTC (rev 254590)
@@ -1,5 +1,44 @@
 2020-01-14  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r254141. rdar://problem/58559202
+
+    Flaky API Test: TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
+    https://bugs.webkit.org/show_bug.cgi?id=194340
+    <rdar://problem/50507254>
+    
+    Reviewed by Eric Carlson.
+    
+    Workaround for AVFoundation crash for OS versions prior to platform fix. This crash occurrs infrequently
+    while triggering KVO due to an internal @property change. Work around the crash by disabling KVO for that
+    property at runtime, by injecting a new class method +automaticallyNotifiesObserversOfSuppressesVideoLayers
+    immediately after soft linking the AVFoundation library.
+    
+    * pal/cocoa/AVFoundationSoftLink.mm:
+    (PAL::justReturnsNO):
+    (PAL::AVFoundationLibrary):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-07  Jer Noble  <jer.no...@apple.com>
+
+            Flaky API Test: TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
+            https://bugs.webkit.org/show_bug.cgi?id=194340
+            <rdar://problem/50507254>
+
+            Reviewed by Eric Carlson.
+
+            Workaround for AVFoundation crash for OS versions prior to platform fix. This crash occurrs infrequently
+            while triggering KVO due to an internal @property change. Work around the crash by disabling KVO for that
+            property at runtime, by injecting a new class method +automaticallyNotifiesObserversOfSuppressesVideoLayers
+            immediately after soft linking the AVFoundation library.
+
+            * pal/cocoa/AVFoundationSoftLink.mm:
+            (PAL::justReturnsNO):
+            (PAL::AVFoundationLibrary):
+
+2020-01-14  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r254042. rdar://problem/58549102
 
     Source/WebCore/PAL:

Modified: branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm (254589 => 254590)


--- branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm	2020-01-15 19:14:45 UTC (rev 254589)
+++ branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm	2020-01-15 19:14:47 UTC (rev 254590)
@@ -30,8 +30,38 @@
 #import <AVFoundation/AVFoundation.h>
 #import <wtf/SoftLinking.h>
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
 SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, PAL_EXPORT)
+#else
+@interface AVPlayerItem (DisableKVOOnSupressesVideoLayers)
++ (BOOL)automaticallyNotifiesObserversOfSuppressesVideoLayers;
+@end
 
+namespace PAL {
+
+static BOOL justReturnsNO()
+{
+    return NO;
+}
+
+PAL_EXPORT void* AVFoundationLibrary(bool isOptional = false);
+void* AVFoundationLibrary(bool isOptional)
+{
+    static void* frameworkLibrary;
+    static dispatch_once_t once;
+    dispatch_once(&once, ^{
+        frameworkLibrary = dlopen("/System/Library/Frameworks/AVFoundation.framework/AVFoundation", RTLD_NOW);
+        if (!isOptional)
+            RELEASE_ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror());
+
+        class_addMethod(objc_getClass("AVPlayerItem"), @selector(automaticallyNotifiesObserversOfSuppressesVideoLayers), (IMP)justReturnsNO, "B@:");
+    });
+    return frameworkLibrary;
+}
+
+}
+#endif
+
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAssetCache, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAssetImageGenerator, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAssetReader, PAL_EXPORT)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to