Changeset 287899 in webkit


Ignore:
Timestamp:
Jan 11, 2022, 3:25:09 PM (4 years ago)
Author:
Peng Liu
Message:

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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r287896 r287899  
     12022-01-11  Peng Liu  <peng.liu6@apple.com>
     2
     3        DataURLResourceMediaLoader decodes the URL repeatedly during a video playback
     4        https://bugs.webkit.org/show_bug.cgi?id=234940
     5
     6        Reviewed by Darin Adler.
     7
     8        In r264864, we adopted a new SPI to tell AVFoundation that the entire file is available for custom URLs.
     9        As a result, during a video playback, AVFoundation will request small data ranges instead of "caching"
     10        the whole file again.
     11
     12        However, that leads to efficiency issue for DataURLResourceMediaLoader. Because it needs to decode the whole
     13        URL when AVFoundation requests a data range, which is inefficient when the URL is very long.
     14
     15        This patch reverts the change in r264864 for the DataURLResourceMediaLoader case to fix the performance issue.
     16        If DataURLDecoder::decode() supports decoding a data range in the future, we can change it back for better
     17        memory efficiency.
     18
     19        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
     20        (WebCore::WebCoreAVFResourceLoader::responseReceived):
     21
    1222022-01-11  Antoine Quint  <graouts@webkit.org>
    223
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm

    r287684 r287899  
    358358        [contentInfo setContentLength:contentRange.isValid() ? contentRange.instanceLength() : response.expectedContentLength()];
    359359        [contentInfo setByteRangeAccessSupported:YES];
    360        
    361         if ([contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])
     360
     361        // Do not set "EntireLengthAvailableOnDemand" to YES when the loader is DataURLResourceMediaLoader.
     362        // When the property is YES, AVAssetResourceLoader will request small data ranges over and over again
     363        // during the playback. For DataURLResourceMediaLoader, that means it needs to decode the URL repeatedly,
     364        // which is very inefficient for long URLs.
     365        if (!m_dataURLMediaLoader && [contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])
    362366            [contentInfo setEntireLengthAvailableOnDemand:YES];
    363367
Note: See TracChangeset for help on using the changeset viewer.