Title: [243404] trunk/Source/WebCore
Revision
243404
Author
[email protected]
Date
2019-03-22 15:54:50 -0700 (Fri, 22 Mar 2019)

Log Message

Flaky AVEncoderBitRateKey symbol not found crash on imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
https://bugs.webkit.org/show_bug.cgi?id=193724
<rdar://problem/47483831>

Reviewed by Jer Noble.

The soft link macros occasionally fail to load constants from AVFoundation.framework
which are actually in one of its sub-frameworks. While we investigate the cause
cause of the failure, ise the SOFT_LINK_CONSTANT_MAY_FAIL so we can detect the failure
and return a local copy of the string instead of crashing.

No new tests, this should prevent existing tests from crashing.

* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::myAVFormatIDKey):
(WebCore::myAVNumberOfChannelsKey):
(WebCore::myAVSampleRateKey):
(WebCore::myAVEncoderBitRateKey):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (243403 => 243404)


--- trunk/Source/WebCore/ChangeLog	2019-03-22 22:19:38 UTC (rev 243403)
+++ trunk/Source/WebCore/ChangeLog	2019-03-22 22:54:50 UTC (rev 243404)
@@ -1,3 +1,24 @@
+2019-03-22  Eric Carlson  <[email protected]>
+
+        Flaky AVEncoderBitRateKey symbol not found crash on imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
+        https://bugs.webkit.org/show_bug.cgi?id=193724
+        <rdar://problem/47483831>
+
+        Reviewed by Jer Noble.
+
+        The soft link macros occasionally fail to load constants from AVFoundation.framework
+        which are actually in one of its sub-frameworks. While we investigate the cause
+        cause of the failure, ise the SOFT_LINK_CONSTANT_MAY_FAIL so we can detect the failure
+        and return a local copy of the string instead of crashing.
+        
+        No new tests, this should prevent existing tests from crashing.
+
+        * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
+        (WebCore::myAVFormatIDKey):
+        (WebCore::myAVNumberOfChannelsKey):
+        (WebCore::myAVSampleRateKey):
+        (WebCore::myAVEncoderBitRateKey):
+
 2019-03-22  Youenn Fablet  <[email protected]>
 
         REGRESSION: Flaky ASSERTION FAILED: !m_killed seen with http/tests/security/cross-origin-worker-indexeddb.html

Modified: trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm (243403 => 243404)


--- trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm	2019-03-22 22:19:38 UTC (rev 243403)
+++ trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm	2019-03-22 22:54:50 UTC (rev 243404)
@@ -52,10 +52,6 @@
 SOFT_LINK_CONSTANT(AVFoundation, AVVideoHeightKey, NSString *)
 SOFT_LINK_CONSTANT(AVFoundation, AVMediaTypeVideo, NSString *)
 SOFT_LINK_CONSTANT(AVFoundation, AVMediaTypeAudio, NSString *)
-SOFT_LINK_CONSTANT(AVFoundation, AVEncoderBitRateKey, NSString *)
-SOFT_LINK_CONSTANT(AVFoundation, AVFormatIDKey, NSString *)
-SOFT_LINK_CONSTANT(AVFoundation, AVNumberOfChannelsKey, NSString *)
-SOFT_LINK_CONSTANT(AVFoundation, AVSampleRateKey, NSString *)
 
 SOFT_LINK_CONSTANT(AVFoundation, AVVideoExpectedSourceFrameRateKey, NSString *)
 SOFT_LINK_CONSTANT(AVFoundation, AVVideoProfileLevelKey, NSString *)
@@ -71,10 +67,6 @@
 #define AVVideoCodecH264 getAVVideoCodecH264()
 #define AVVideoWidthKey getAVVideoWidthKey()
 #define AVVideoHeightKey getAVVideoHeightKey()
-#define AVEncoderBitRateKey getAVEncoderBitRateKey()
-#define AVFormatIDKey getAVFormatIDKey()
-#define AVNumberOfChannelsKey getAVNumberOfChannelsKey()
-#define AVSampleRateKey getAVSampleRateKey()
 
 #define AVVideoExpectedSourceFrameRateKey getAVVideoExpectedSourceFrameRateKey()
 #define AVVideoProfileLevelKey getAVVideoProfileLevelKey()
@@ -83,10 +75,56 @@
 #define AVVideoProfileLevelH264MainAutoLevel getAVVideoProfileLevelH264MainAutoLevel()
 #define AVVideoCompressionPropertiesKey getAVVideoCompressionPropertiesKey()
 
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVEncoderBitRateKey, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVFormatIDKey, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVNumberOfChannelsKey, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVSampleRateKey, NSString *)
+
+#define AVEncoderBitRateKey getAVEncoderBitRateKeyWithFallback()
+#define AVFormatIDKey getAVFormatIDKeyWithFallback()
+#define AVNumberOfChannelsKey getAVNumberOfChannelsKeyWithFallback()
+#define AVSampleRateKey getAVSampleRateKeyWithFallback()
+
 namespace WebCore {
 
 using namespace PAL;
 
+static NSString *getAVFormatIDKeyWithFallback()
+{
+    if (canLoadAVFormatIDKey())
+        return getAVFormatIDKey();
+
+    RELEASE_LOG_ERROR(Media, "Failed to load AVFormatIDKey");
+    return @"AVFormatIDKey";
+}
+
+static NSString *getAVNumberOfChannelsKeyWithFallback()
+{
+    if (canLoadAVNumberOfChannelsKey())
+        return getAVNumberOfChannelsKey();
+
+    RELEASE_LOG_ERROR(Media, "Failed to load AVNumberOfChannelsKey");
+    return @"AVNumberOfChannelsKey";
+}
+
+static NSString *getAVSampleRateKeyWithFallback()
+{
+    if (canLoadAVSampleRateKey())
+        return getAVSampleRateKey();
+
+    RELEASE_LOG_ERROR(Media, "Failed to load AVSampleRateKey");
+    return @"AVSampleRateKey";
+}
+
+static NSString *getAVEncoderBitRateKeyWithFallback()
+{
+    if (canLoadAVEncoderBitRateKey())
+        return getAVEncoderBitRateKey();
+
+    RELEASE_LOG_ERROR(Media, "Failed to load AVEncoderBitRateKey");
+    return @"AVEncoderBitRateKey";
+}
+
 RefPtr<MediaRecorderPrivateWriter> MediaRecorderPrivateWriter::create(const MediaStreamTrackPrivate* audioTrack, const MediaStreamTrackPrivate* videoTrack)
 {
     NSString *directory = FileSystem::createTemporaryDirectory(@"videos");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to