⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 254288 in webkit


Ignore:
Timestamp:
Jan 9, 2020, 12:18:40 PM (7 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] persistent-usage-record message fails first time; succeeds subsequent times
​https://bugs.webkit.org/show_bug.cgi?id=205970
<rdar://problem/57785647>

Reviewed by Eric Carlson.

The AVContentKeySession is created too early; before the CDM has a chance to provide the storage path
for persistent usage records. Delay creation of the AVCKS until it's actually needed during the first
license request.

Drive-by fix: fix the exceptional case where a PUR session is closed but PUR data isn't available; send
a null message rather than an empty array.

  • platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
  • platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:

(WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC): Deleted.
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::ensureSession): Deleted.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r254281 r254288  
     12020-01-09  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] persistent-usage-record message fails first time; succeeds subsequent times
     4        https://bugs.webkit.org/show_bug.cgi?id=205970
     5        <rdar://problem/57785647>
     6
     7        Reviewed by Eric Carlson.
     8
     9        The AVContentKeySession is created too early; before the CDM has a chance to provide the storage path
     10        for persistent usage records. Delay creation of the AVCKS until it's actually needed during the first
     11        license request.
     12
     13        Drive-by fix: fix the exceptional case where a PUR session is closed but PUR data isn't available; send
     14        a null message rather than an empty array.
     15
     16        * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
     17        * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
     18        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession):
     19        (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
     20        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC): Deleted.
     21        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::ensureSession): Deleted.
     22
    1232020-01-09  Zalan Bujtas  <zalan@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h

    r253064 r254288  
    8888    bool persistentStateAllowed() const { return m_persistentStateAllowed; }
    8989    SharedBuffer* serverCertificate() const { return m_serverCertificate.get(); }
    90     AVContentKeySession* contentKeySession() { return m_session.get(); }
     90    AVContentKeySession* contentKeySession();
    9191
    9292    // AVContentKeySessionDelegateClient
    … …  
    107107
    108108private:
    109     void ensureSession();
    110 
    111109    RetainPtr<AVContentKeySession> m_session;
    112110    RetainPtr<WebCoreFPSContentKeySessionDelegate> m_delegate;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm

    r253852 r254288  
    160160namespace WebCore {
    161161
    162 CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC()
    163 {
    164     if (PAL::getAVContentKeyReportGroupClass())
    165         ensureSession();
    166 }
    167 
    168 void CDMInstanceFairPlayStreamingAVFObjC::ensureSession()
     162CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC() = default;
     163
     164AVContentKeySession* CDMInstanceFairPlayStreamingAVFObjC::contentKeySession()
    169165{
    170166    if (m_session)
    171         return;
     167        return m_session.get();
    172168
    173169    if (!PAL::canLoad_AVFoundation_AVContentKeySystemFairPlayStreaming())
    174         return;
     170        return nullptr;
     171
     172    if (!PAL::getAVContentKeyReportGroupClass())
     173        return nullptr;
    175174
    176175    auto storageURL = this->storageURL();
    … …  
    181180
    182181    if (!m_session)
    183         return;
     182        return nullptr;
    184183
    185184    if (!m_delegate)
    … …  
    187186
    188187    [m_session setDelegate:m_delegate.get() queue:dispatch_get_main_queue()];
     188    return m_session.get();
    189189}
    190190
    … …  
    817817        }
    818818
     819        if (!expiredSessionsArray.get().count) {
     820            callback(WTFMove(changedKeys), WTF::nullopt, Succeeded);
     821            return;
     822        }
     823
    819824        RetainPtr<NSData> expiredSessionsData = [NSPropertyListSerialization dataWithPropertyList:expiredSessionsArray.get() format:NSPropertyListBinaryFormat_v1_0 options:kCFPropertyListImmutable error:nullptr];
    820825
Note: See TracChangeset for help on using the changeset viewer.