Title: [289259] branches/safari-613-branch/Source/WebCore
Revision
289259
Author
[email protected]
Date
2022-02-07 18:52:14 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r287899. rdar://problem/83925935

    DataURLResourceMediaLoader decodes the URL repeatedly during a video playback
    https://bugs.webkit.org/show_bug.cgi?id=234940

    Reviewed by Darin Adler.

    In r264864, we adopted a new SPI to tell AVFoundation that the entire file is available for custom URLs.
    As a result, during a video playback, AVFoundation will request small data ranges instead of "caching"
    the whole file again.

    However, that leads to efficiency issue for DataURLResourceMediaLoader. Because it needs to decode the whole
    URL when AVFoundation requests a data range, which is inefficient when the URL is very long.

    This patch reverts the change in r264864 for the DataURLResourceMediaLoader case to fix the performance issue.
    If DataURLDecoder::decode() supports decoding a data range in the future, we can change it back for better
    memory efficiency.

    * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
    (WebCore::WebCoreAVFResourceLoader::responseReceived):

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289258 => 289259)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:52:11 UTC (rev 289258)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:52:14 UTC (rev 289259)
@@ -1,5 +1,52 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r287899. rdar://problem/83925935
+
+    DataURLResourceMediaLoader decodes the URL repeatedly during a video playback
+    https://bugs.webkit.org/show_bug.cgi?id=234940
+    
+    Reviewed by Darin Adler.
+    
+    In r264864, we adopted a new SPI to tell AVFoundation that the entire file is available for custom URLs.
+    As a result, during a video playback, AVFoundation will request small data ranges instead of "caching"
+    the whole file again.
+    
+    However, that leads to efficiency issue for DataURLResourceMediaLoader. Because it needs to decode the whole
+    URL when AVFoundation requests a data range, which is inefficient when the URL is very long.
+    
+    This patch reverts the change in r264864 for the DataURLResourceMediaLoader case to fix the performance issue.
+    If DataURLDecoder::decode() supports decoding a data range in the future, we can change it back for better
+    memory efficiency.
+    
+    * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+    (WebCore::WebCoreAVFResourceLoader::responseReceived):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-11  Peng Liu  <[email protected]>
+
+            DataURLResourceMediaLoader decodes the URL repeatedly during a video playback
+            https://bugs.webkit.org/show_bug.cgi?id=234940
+
+            Reviewed by Darin Adler.
+
+            In r264864, we adopted a new SPI to tell AVFoundation that the entire file is available for custom URLs.
+            As a result, during a video playback, AVFoundation will request small data ranges instead of "caching"
+            the whole file again.
+
+            However, that leads to efficiency issue for DataURLResourceMediaLoader. Because it needs to decode the whole
+            URL when AVFoundation requests a data range, which is inefficient when the URL is very long.
+
+            This patch reverts the change in r264864 for the DataURLResourceMediaLoader case to fix the performance issue.
+            If DataURLDecoder::decode() supports decoding a data range in the future, we can change it back for better
+            memory efficiency.
+
+            * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+            (WebCore::WebCoreAVFResourceLoader::responseReceived):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r287847. rdar://problem/86488039
 
     ASSERTION FAILED in RenderLayer::updateClipRects

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (289258 => 289259)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2022-02-08 02:52:11 UTC (rev 289258)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2022-02-08 02:52:14 UTC (rev 289259)
@@ -357,8 +357,12 @@
 
         [contentInfo setContentLength:contentRange.isValid() ? contentRange.instanceLength() : response.expectedContentLength()];
         [contentInfo setByteRangeAccessSupported:YES];
-        
-        if ([contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])
+
+        // Do not set "EntireLengthAvailableOnDemand" to YES when the loader is DataURLResourceMediaLoader.
+        // When the property is YES, AVAssetResourceLoader will request small data ranges over and over again
+        // during the playback. For DataURLResourceMediaLoader, that means it needs to decode the URL repeatedly,
+        // which is very inefficient for long URLs.
+        if (!m_dataURLMediaLoader && [contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])
             [contentInfo setEntireLengthAvailableOnDemand:YES];
 
         if (![m_avRequest dataRequest]) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to