Title: [271038] trunk/Source
Revision
271038
Author
[email protected]
Date
2020-12-21 12:48:53 -0800 (Mon, 21 Dec 2020)

Log Message

Unreviewed, reverting r270939 and r270952.

Caused layout test timeouts on internal bots

Reverted changesets:

"[Cocoa] WebM format reader doesn't work with a url in a
<source> element"
https://bugs.webkit.org/show_bug.cgi?id=219961
https://trac.webkit.org/changeset/270939

"[Cocoa] WebM format reader doesn't work with a url in a
<source> element"
https://bugs.webkit.org/show_bug.cgi?id=219961
https://trac.webkit.org/changeset/270952

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271037 => 271038)


--- trunk/Source/WebCore/ChangeLog	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/ChangeLog	2020-12-21 20:48:53 UTC (rev 271038)
@@ -1,3 +1,21 @@
+2020-12-21  Ryan Haddad  <[email protected]>
+
+        Unreviewed, reverting r270939 and r270952.
+
+        Caused layout test timeouts on internal bots
+
+        Reverted changesets:
+
+        "[Cocoa] WebM format reader doesn't work with a url in a
+        <source> element"
+        https://bugs.webkit.org/show_bug.cgi?id=219961
+        https://trac.webkit.org/changeset/270939
+
+        "[Cocoa] WebM format reader doesn't work with a url in a
+        <source> element"
+        https://bugs.webkit.org/show_bug.cgi?id=219961
+        https://trac.webkit.org/changeset/270952
+
 2020-12-21  Wenson Hsieh  <[email protected]>
 
         Many websites crash under toDataURL() when enabling GPU process for DOM

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h (271037 => 271038)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h	2020-12-21 20:48:53 UTC (rev 271038)
@@ -45,8 +45,6 @@
     bool isUnsupportedContainerType(const String&) final;
 
     void addSupportedTypes(const Vector<String>&);
-    
-    void setWebMFormatReaderEnabled(bool);
 
 private:
     friend NeverDestroyed<AVAssetMIMETypeCache>;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm (271037 => 271038)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm	2020-12-21 20:48:53 UTC (rev 271038)
@@ -29,7 +29,6 @@
 #if PLATFORM(COCOA)
 
 #import "ContentType.h"
-#import "SourceBufferParserWebM.h"
 #import <pal/cf/CoreMediaSoftLink.h>
 #import <pal/cocoa/AVFoundationSoftLink.h>
 
@@ -64,16 +63,9 @@
 {
 #if ENABLE(VIDEO) && USE(AVFOUNDATION)
     ASSERT(isAvailable());
-    if ([PAL::getAVURLAssetClass() isPlayableExtendedMIMEType:type.raw()])
-        return true;
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    if (SourceBufferParserWebM::isContentTypeSupported(type) == MediaPlayerEnums::SupportsType::IsSupported)
-        return true;
+    return [PAL::getAVURLAssetClass() isPlayableExtendedMIMEType:type.raw()];
 #endif
 
-#endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
-
     return false;
 }
 
@@ -156,28 +148,11 @@
     for (NSString* type in [PAL::getAVURLAssetClass() audiovisualMIMETypes])
         cache.add(type);
 
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    if (SourceBufferParserWebM::isWebMFormatReaderAvailable()) {
-        auto webmTypes = SourceBufferParserWebM::webmMIMETypes();
-        cache.add(webmTypes.begin(), webmTypes.end());
-    }
-#endif
-
     if (m_cacheTypeCallback)
         m_cacheTypeCallback(copyToVector(cache));
 #endif
 }
 
-void AVAssetMIMETypeCache::setWebMFormatReaderEnabled(bool enabled)
-{
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    SourceBufferParserWebM::setWebMFormatReaderEnabled(enabled);
-#else
-    UNUSED_PARAM(enabled);
-#endif
 }
 
-
-}
-
 #endif

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (271037 => 271038)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-12-21 20:48:53 UTC (rev 271038)
@@ -56,6 +56,7 @@
 #import "PixelBufferConformerCV.h"
 #import "PlatformTimeRanges.h"
 #import "RuntimeApplicationChecks.h"
+#import "RuntimeEnabledFeatures.h"
 #import "SecurityOrigin.h"
 #import "SerializedPlatformDataCueMac.h"
 #import "SharedBuffer.h"
@@ -99,6 +100,7 @@
 #import <wtf/OSObjectPtr.h>
 #import <wtf/URL.h>
 #import <wtf/cocoa/VectorCocoa.h>
+#import <wtf/spi/darwin/OSVariantSPI.h>
 #import <wtf/text/CString.h>
 #import <wtf/threads/BinarySemaphore.h>
 
@@ -268,20 +270,6 @@
     return globalQueue;
 }
 
-static void registerFormatReaderIfNecessary()
-{
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        // Like we do for other media formats, allow the format reader to run in the WebContent or GPU process
-        // (which is already appropriately sandboxed) rather than in a separate MediaToolbox XPC service.
-        RELEASE_ASSERT(isInGPUProcess() || isInWebProcess());
-        MTRegisterPluginFormatReaderBundleDirectory((__bridge CFURLRef)NSBundle.mainBundle.builtInPlugInsURL);
-        MTPluginFormatReaderDisableSandboxing();
-    });
-#endif
-}
-
 class MediaPlayerPrivateAVFoundationObjC::Factory final : public MediaPlayerFactory {
 private:
     MediaPlayerEnums::MediaEngineIdentifier identifier() const final { return MediaPlayerEnums::MediaEngineIdentifier::AVFoundation; };
@@ -804,19 +792,6 @@
 
 }
 
-static bool willUseWebMFormatReaderForType(const String& type)
-{
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    if (!SourceBufferParserWebM::isWebMFormatReaderAvailable())
-        return false;
-    
-    return equalIgnoringASCIICase(type, "video/webm") || equalIgnoringASCIICase(type, "audio/webm");
-#else
-    UNUSED_PARAM(type);
-    return false;
-#endif
-}
-
 void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const URL& url, RetainPtr<NSMutableDictionary> options)
 {
     ALWAYS_LOG(LOGIDENTIFIER);
@@ -858,11 +833,7 @@
 #endif
 
     auto type = player()->contentMIMEType();
-
-    // Don't advertise WebM MIME types or the format reader won't be loaded until rdar://72405127 is fixed.
-    auto willUseWebMFormatReader = willUseWebMFormatReaderForType(type);
-
-    if (PAL::canLoad_AVFoundation_AVURLAssetOutOfBandMIMETypeKey() && !type.isEmpty() && !player()->contentMIMETypeWasInferredFromExtension() && !willUseWebMFormatReader) {
+    if (PAL::canLoad_AVFoundation_AVURLAssetOutOfBandMIMETypeKey() && !type.isEmpty() && !player()->contentMIMETypeWasInferredFromExtension()) {
         auto codecs = player()->contentTypeCodecs();
         if (!codecs.isEmpty()) {
             NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)type, (NSString *)codecs];
@@ -905,9 +876,6 @@
             [options setObject:@NO forKey:AVURLAssetUsesNoPersistentCacheKey];
     }
 
-    if (willUseWebMFormatReader)
-        registerFormatReaderIfNecessary();
-
     NSURL *cocoaURL = canonicalURL(url);
     m_avAsset = adoptNS([PAL::allocAVURLAssetInstance() initWithURL:cocoaURL options:options.get()]);
 
@@ -1699,6 +1667,39 @@
 }
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
+static void ensureFormatReaderIsRegistered()
+{
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        // Like we do for other media formats, allow the format reader to run in the WebContent or GPU process
+        // (which is already appropriately sandboxed) rather than in a separate MediaToolbox XPC service.
+        RELEASE_ASSERT(isInGPUProcess() || isInWebProcess());
+        MTRegisterPluginFormatReaderBundleDirectory((__bridge CFURLRef)NSBundle.mainBundle.builtInPlugInsURL);
+        MTPluginFormatReaderDisableSandboxing();
+    });
+}
+#endif
+
+#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
+static bool isFormatReaderAvailable()
+{
+    if (!RuntimeEnabledFeatures::sharedFeatures().webMFormatReaderEnabled())
+        return false;
+
+#if !USE(APPLE_INTERNAL_SDK)
+    // FIXME (rdar://72320419): If WebKit was built with ad-hoc code-signing,
+    // CoreMedia will only load the format reader plug-in when a user default
+    // is set on Apple internal OSs. That means we cannot currently support WebM
+    // in public SDK builds on customer OSs.
+    if (!os_variant_allows_internal_security_policies("com.apple.WebKit"))
+        return false;
+#endif
+
+    return true;
+}
+#endif
+
 MediaPlayer::SupportsType MediaPlayerPrivateAVFoundationObjC::supportsTypeAndCodecs(const MediaEngineSupportParameters& parameters)
 {
 #if ENABLE(MEDIA_SOURCE)
@@ -1710,6 +1711,19 @@
         return MediaPlayer::SupportsType::IsNotSupported;
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
+    if (isFormatReaderAvailable()) {
+        auto supported = SourceBufferParserWebM::isContentTypeSupported(parameters.type);
+        if (supported != MediaPlayer::SupportsType::IsNotSupported) {
+            ensureFormatReaderIsRegistered();
+            if (supported == MediaPlayer::SupportsType::MayBeSupported)
+                return supported;
+            if (contentTypeMeetsHardwareDecodeRequirements(parameters.type, parameters.contentTypesRequiringHardwareSupport))
+                return MediaPlayer::SupportsType::IsSupported;
+        }
+    }
+#endif
+
     auto supported = AVAssetMIMETypeCache::singleton().canDecodeType(parameters.type.raw());
     if (supported != MediaPlayer::SupportsType::IsSupported)
         return supported;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (271037 => 271038)


--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-12-21 20:48:53 UTC (rev 271038)
@@ -48,7 +48,6 @@
 #include <wtf/StdList.h>
 #include <wtf/cf/TypeCastsCF.h>
 #include <wtf/darwin/WeakLinking.h>
-#include <wtf/spi/darwin/OSVariantSPI.h>
 
 #include "CoreVideoSoftLink.h"
 #include "VideoToolboxSoftLink.h"
@@ -444,57 +443,6 @@
     webm::TrackEntry m_track;
 };
 
-bool SourceBufferParserWebM::m_formatReaderEnabled;
-
-void SourceBufferParserWebM::setWebMFormatReaderEnabled(bool enabled)
-{
-#if HAVE(MT_PLUGIN_FORMAT_READER)
-    m_formatReaderEnabled = enabled;
-#else
-    UNUSED_PARAM(enabled);
-#endif
-}
-
-const HashSet<String, ASCIICaseInsensitiveHash>& SourceBufferParserWebM::webmMIMETypes()
-{
-    static auto types = makeNeverDestroyed([] {
-
-        HashSet<String, ASCIICaseInsensitiveHash> types;
-
-#if ENABLE(VP9)
-        types.add("video/webm");
-#endif
-#if ENABLE(VORBIS) || ENABLE(OPUS)
-        types.add("audio/webm");
-#endif
-
-        return types;
-    }());
-
-    return types;
-}
-
-static bool canLoadFormatReader()
-{
-#if !HAVE(MT_PLUGIN_FORMAT_READER)
-    return false;
-#elif USE(APPLE_INTERNAL_SDK)
-    return true;
-#else
-    // FIXME (rdar://72320419): If WebKit was built with ad-hoc code-signing,
-    // CoreMedia will only load the format reader plug-in when a user default
-    // is set on Apple internal OSs. That means we cannot currently support WebM
-    // in public SDK builds on customer OSs.
-    static bool allowsInternalSecurityPolicies = os_variant_allows_internal_security_policies("com.apple.WebKit");
-    return allowsInternalSecurityPolicies;
-#endif // !USE(APPLE_INTERNAL_SDK)
-}
-
-bool SourceBufferParserWebM::isWebMFormatReaderAvailable()
-{
-    return m_formatReaderEnabled && canLoadFormatReader() && isWebmParserAvailable();
-}
-
 MediaPlayerEnums::SupportsType SourceBufferParserWebM::isContentTypeSupported(const ContentType& type)
 {
 #if ENABLE(VP9) || ENABLE(VORBIS) || ENABLE(OPUS)
@@ -501,9 +449,8 @@
     if (!isWebmParserAvailable())
         return MediaPlayerEnums::SupportsType::IsNotSupported;
 
-    auto containerType = type.containerType();
-    bool isAudioContainerType = WTF::equalIgnoringASCIICase(containerType, "audio/webm");
-    bool isVideoContainerType = WTF::equalIgnoringASCIICase(containerType, "video/webm");
+    bool isAudioContainerType = WTF::equalIgnoringASCIICase(type.containerType(), "audio/webm");
+    bool isVideoContainerType = WTF::equalIgnoringASCIICase(type.containerType(), "video/webm");
     if (!isAudioContainerType && !isVideoContainerType)
         return MediaPlayerEnums::SupportsType::IsNotSupported;
     
@@ -526,18 +473,22 @@
     if (!isAnyCodecAvailable)
         return MediaPlayerEnums::SupportsType::IsNotSupported;
 
-    auto codecs = type.codecs();
-    if (codecs.isEmpty())
+    String codecsParameter = type.parameter(ContentType::codecsParameter());
+    if (!codecsParameter)
         return MediaPlayerEnums::SupportsType::MayBeSupported;
 
-    for (auto& codec : codecs) {
+    auto splitResults = StringView(codecsParameter).split(',');
+    if (splitResults.begin() == splitResults.end())
+        return MediaPlayerEnums::SupportsType::MayBeSupported;
+
+    for (auto split : splitResults) {
 #if ENABLE(VP9)
-        if (codec.startsWith("vp09") || codec.startsWith("vp08") || equal(codec, "vp8") || equal(codec, "vp9")) {
+        if (split.startsWith("vp09") || split.startsWith("vp08") || equal(split, "vp8") || equal(split, "vp9")) {
 
             if (!isVP9DecoderAvailable())
                 return MediaPlayerEnums::SupportsType::IsNotSupported;
 
-            auto codecParameters = parseVPCodecParameters(codec);
+            auto codecParameters = parseVPCodecParameters(split);
             if (!codecParameters)
                 return MediaPlayerEnums::SupportsType::IsNotSupported;
 
@@ -549,7 +500,7 @@
 #endif // ENABLE(VP9)
 
 #if ENABLE(VORBIS)
-        if (codec == "vorbis") {
+        if (split == "vorbis") {
             if (!isVorbisDecoderAvailable())
                 return MediaPlayerEnums::SupportsType::IsNotSupported;
 
@@ -558,7 +509,7 @@
 #endif // ENABLE(VORBIS)
 
 #if ENABLE(OPUS)
-        if (codec == "opus") {
+        if (split == "opus") {
             if (!isOpusDecoderAvailable())
                 return MediaPlayerEnums::SupportsType::IsNotSupported;
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h (271037 => 271038)


--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h	2020-12-21 20:48:53 UTC (rev 271038)
@@ -60,10 +60,7 @@
 public:
     class StreamingVectorReader;
 
-    static bool isWebMFormatReaderAvailable();
-    static void setWebMFormatReaderEnabled(bool);
     static MediaPlayerEnums::SupportsType isContentTypeSupported(const ContentType&);
-    static const HashSet<String, ASCIICaseInsensitiveHash>& webmMIMETypes();
     static RefPtr<SourceBufferParserWebM> create(const ContentType&);
 
     SourceBufferParserWebM();
@@ -271,8 +268,6 @@
 
     RefPtr<const WTF::Logger> m_logger;
     const void* m_logIdentifier { nullptr };
-    
-    static bool m_formatReaderEnabled;
 };
 
 }

Modified: trunk/Source/WebKit/ChangeLog (271037 => 271038)


--- trunk/Source/WebKit/ChangeLog	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebKit/ChangeLog	2020-12-21 20:48:53 UTC (rev 271038)
@@ -1,3 +1,21 @@
+2020-12-21  Ryan Haddad  <[email protected]>
+
+        Unreviewed, reverting r270939 and r270952.
+
+        Caused layout test timeouts on internal bots
+
+        Reverted changesets:
+
+        "[Cocoa] WebM format reader doesn't work with a url in a
+        <source> element"
+        https://bugs.webkit.org/show_bug.cgi?id=219961
+        https://trac.webkit.org/changeset/270939
+
+        "[Cocoa] WebM format reader doesn't work with a url in a
+        <source> element"
+        https://bugs.webkit.org/show_bug.cgi?id=219961
+        https://trac.webkit.org/changeset/270952
+
 2020-12-21  Wenson Hsieh  <[email protected]>
 
         Many websites crash under toDataURL() when enabling GPU process for DOM

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (271037 => 271038)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-12-21 20:48:53 UTC (rev 271038)
@@ -341,10 +341,6 @@
 #endif
 #endif
 
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-#include <WebCore/AVAssetMIMETypeCache.h>
-#endif
-
 namespace WebKit {
 using namespace JSC;
 using namespace WebCore;
@@ -3847,10 +3843,6 @@
             settings.setWebAuthenticationEnabled(true);
     }
 #endif
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    AVAssetMIMETypeCache::singleton().setWebMFormatReaderEnabled(RuntimeEnabledFeatures::sharedFeatures().webMFormatReaderEnabled());
-#endif
 }
 
 #if ENABLE(DATA_DETECTION)

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (271037 => 271038)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-12-21 20:46:10 UTC (rev 271037)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-12-21 20:48:53 UTC (rev 271038)
@@ -69,7 +69,6 @@
 #import <WebCore/PerformanceLogging.h>
 #import <WebCore/PictureInPictureSupport.h>
 #import <WebCore/RuntimeApplicationChecks.h>
-#import <WebCore/RuntimeEnabledFeatures.h>
 #import <WebCore/SWContextManager.h>
 #import <WebCore/SystemBattery.h>
 #import <WebCore/SystemSoundManager.h>
@@ -329,10 +328,6 @@
     pthread_set_fixedpriority_self();
 #endif
 
-#if ENABLE(MEDIA_SOURCE) && HAVE(MT_PLUGIN_FORMAT_READER)
-    AVAssetMIMETypeCache::singleton().setWebMFormatReaderEnabled(RuntimeEnabledFeatures::sharedFeatures().webMFormatReaderEnabled());
-#endif
-
     if (!parameters.mediaMIMETypes.isEmpty())
         setMediaMIMETypes(parameters.mediaMIMETypes);
     else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to