Title: [227409] trunk/Source/WebCore
Revision
227409
Author
commit-qu...@webkit.org
Date
2018-01-23 04:07:42 -0800 (Tue, 23 Jan 2018)

Log 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_...@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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227408 => 227409)


--- trunk/Source/WebCore/ChangeLog	2018-01-23 09:43:46 UTC (rev 227408)
+++ trunk/Source/WebCore/ChangeLog	2018-01-23 12:07:42 UTC (rev 227409)
@@ -1,3 +1,30 @@
+2018-01-23  Yacine Bandou  <yacine.bandou_...@softathome.com>
+
+        [EME] Add support of multi keys from different sessions in CDMinstanceClearKey
+        https://bugs.webkit.org/show_bug.cgi?id=180083
+
+        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:
+
 2018-01-22  Simon Fraser  <simon.fra...@apple.com>
 
         Optimize building the non-fast scrollable region with multiple iframes

Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp (227408 => 227409)


--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	2018-01-23 09:43:46 UTC (rev 227408)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	2018-01-23 12:07:42 UTC (rev 227409)
@@ -480,6 +480,16 @@
         });
 }
 
+const Vector<CDMInstanceClearKey::Key> CDMInstanceClearKey::keys() const
+{
+    // Return the keys of all sessions.
+    Vector<CDMInstanceClearKey::Key> allKeys { };
+    for (auto& key : ClearKeyState::singleton().keys().values())
+        allKeys.appendVector(key);
+
+    return allKeys;
+}
+
 void CDMInstanceClearKey::updateLicense(const String& sessionId, LicenseType, const SharedBuffer& response, LicenseUpdateCallback callback)
 {
     // Use a helper functor that schedules the callback dispatch, avoiding
@@ -565,9 +575,6 @@
             changedKeys = WTFMove(keyStatusVector);
         }
 
-        // Cache the key information Vector on CDMInstance for easier access from the pipeline.
-        m_keys = keyVector;
-
         dispatchCallback(false, WTFMove(changedKeys), SuccessValue::Succeeded);
         return;
     }
@@ -576,7 +583,6 @@
     if (parseLicenseReleaseAcknowledgementFormat(*root)) {
         // FIXME: Retrieve the key ID information and use it to validate the keys for this sessionId.
         ClearKeyState::singleton().keys().remove(sessionId);
-        m_keys.clear();
         dispatchCallback(true, std::nullopt, SuccessValue::Succeeded);
         return;
     }

Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h (227408 => 227409)


--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h	2018-01-23 09:43:46 UTC (rev 227408)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h	2018-01-23 12:07:42 UTC (rev 227409)
@@ -102,11 +102,10 @@
         RefPtr<SharedBuffer> keyValueData;
     };
 
-    const Vector<Key>& keys() const { return m_keys; }
+    const Vector<Key> keys() const;
 
 private:
     WeakPtrFactory<CDMInstanceClearKey> m_weakPtrFactory;
-    Vector<Key> m_keys;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to