Changeset 227409 in webkit


Ignore:
Timestamp:
Jan 23, 2018 4:07:42 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[EME] Add support of multi keys from different sessions in CDMinstanceClearKey
https://bugs.webkit.org/show_bug.cgi?id=180083

Patch by Yacine Bandou <yacine.bandou_ext@softathome.com> on 2018-01-23
Reviewed by Xabier Rodriguez-Calvar.

Add support of multi keys from different MediaKeySession in CDMInstanceClearKey.

Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector
where it stores the list of last added keys, an other which is defined in the
ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the
keys lists of each created session.

The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which
contains just the list of last keys.

The goal of this commit is to return all keys lists of all sessions, thus
we remove the "m_keys" which is WTF::Vector and we modify the method
"keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap,
in one Vector instead of return just the list of last keys.

  • platform/encryptedmedia/clearkey/CDMClearKey.cpp:

(WebCore::CDMInstanceClearKey::keys const):
(WebCore::CDMInstanceClearKey::updateLicense):

  • platform/encryptedmedia/clearkey/CDMClearKey.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r227396 r227409  
     12018-01-23  Yacine Bandou  <yacine.bandou_ext@softathome.com>
     2
     3        [EME] Add support of multi keys from different sessions in CDMinstanceClearKey
     4        https://bugs.webkit.org/show_bug.cgi?id=180083
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Add support of multi keys from different MediaKeySession in CDMInstanceClearKey.
     9
     10        Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector
     11        where it stores the list of last added keys, an other which is defined in the
     12        ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the
     13        keys lists of each created session.
     14
     15        The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which
     16        contains just the list of last keys.
     17
     18        The goal of this commit is to return all keys lists of all sessions, thus
     19        we remove the "m_keys" which is WTF::Vector and we modify the method
     20        "keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap,
     21        in one Vector instead of return just the list of last keys.
     22
     23        * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
     24        (WebCore::CDMInstanceClearKey::keys const):
     25        (WebCore::CDMInstanceClearKey::updateLicense):
     26        * platform/encryptedmedia/clearkey/CDMClearKey.h:
     27
    1282018-01-22  Simon Fraser  <simon.fraser@apple.com>
    229
  • trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp

    r226965 r227409  
    481481}
    482482
     483const Vector<CDMInstanceClearKey::Key> CDMInstanceClearKey::keys() const
     484{
     485    // Return the keys of all sessions.
     486    Vector<CDMInstanceClearKey::Key> allKeys { };
     487    for (auto& key : ClearKeyState::singleton().keys().values())
     488        allKeys.appendVector(key);
     489
     490    return allKeys;
     491}
     492
    483493void CDMInstanceClearKey::updateLicense(const String& sessionId, LicenseType, const SharedBuffer& response, LicenseUpdateCallback callback)
    484494{
     
    566576        }
    567577
    568         // Cache the key information Vector on CDMInstance for easier access from the pipeline.
    569         m_keys = keyVector;
    570 
    571578        dispatchCallback(false, WTFMove(changedKeys), SuccessValue::Succeeded);
    572579        return;
     
    577584        // FIXME: Retrieve the key ID information and use it to validate the keys for this sessionId.
    578585        ClearKeyState::singleton().keys().remove(sessionId);
    579         m_keys.clear();
    580586        dispatchCallback(true, std::nullopt, SuccessValue::Succeeded);
    581587        return;
  • trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h

    r224707 r227409  
    103103    };
    104104
    105     const Vector<Key>& keys() const { return m_keys; }
     105    const Vector<Key> keys() const;
    106106
    107107private:
    108108    WeakPtrFactory<CDMInstanceClearKey> m_weakPtrFactory;
    109     Vector<Key> m_keys;
    110109};
    111110
Note: See TracChangeset for help on using the changeset viewer.