Bug 1516669 - Update fake-cdm to use CDM10 interface. r=cpearce
authorBryce Van Dyk <bvandyk@mozilla.com>
Mon, 14 Jan 2019 16:41:55 +0000
changeset 453764 041c4580aa6f1f23bd0fcc5349026f7abd5f31f7
parent 453763 bd1e99a6325ade1c8839e8e7b7310b76609e3c0a
child 453765 b45954a2a5b8f59dd7b22c7dc85722f414a3613b
push id35372
push usercbrindusan@mozilla.com
push dateMon, 14 Jan 2019 21:49:33 +0000
treeherdermozilla-central@50b3268954b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1516669
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516669 - Update fake-cdm to use CDM10 interface. r=cpearce Differential Revision: https://phabricator.services.mozilla.com/D15520
dom/media/fake-cdm/cdm-fake.cpp
dom/media/fake-cdm/cdm-test-decryptor.cpp
dom/media/fake-cdm/cdm-test-decryptor.h
dom/media/fake-cdm/cdm-test-storage.cpp
dom/media/fake-cdm/cdm-test-storage.h
dom/media/fake-cdm/manifest.json
--- a/dom/media/fake-cdm/cdm-fake.cpp
+++ b/dom/media/fake-cdm/cdm-fake.cpp
@@ -42,21 +42,21 @@ extern "C" {
 
 CDM_API
 void INITIALIZE_CDM_MODULE() {}
 
 CDM_API
 void* CreateCdmInstance(int cdm_interface_version, const char* key_system,
                         uint32_t key_system_size,
                         GetCdmHostFunc get_cdm_host_func, void* user_data) {
-  if (cdm_interface_version != cdm::ContentDecryptionModule_9::kVersion) {
-    // Only support CDM version 9 currently.
+  if (cdm_interface_version != cdm::ContentDecryptionModule_10::kVersion) {
+    // Only support CDM version 10 currently.
     return nullptr;
   }
-  cdm::Host_9* host = static_cast<cdm::Host_9*>(
+  cdm::Host_10* host = static_cast<cdm::Host_10*>(
       get_cdm_host_func(cdm_interface_version, user_data));
   return new FakeDecryptor(host);
 }
 
 CDM_API
 bool VerifyCdmHost_0(const cdm::HostFile* aHostFiles, uint32_t aNumFiles) {
   return true;
 }
--- a/dom/media/fake-cdm/cdm-test-decryptor.cpp
+++ b/dom/media/fake-cdm/cdm-test-decryptor.cpp
@@ -67,17 +67,17 @@ class TestManager {
   static void Error(const string& msg) { FakeDecryptor::Message(msg); }
 
   static void Finish() { FakeDecryptor::Message("test-storage complete"); }
 
   std::mutex mMutex;
   set<string> mTestIDs;
 };
 
-FakeDecryptor::FakeDecryptor(cdm::Host_9* aHost) : mHost(aHost) {
+FakeDecryptor::FakeDecryptor(cdm::Host_10* aHost) : mHost(aHost) {
   MOZ_ASSERT(!sInstance);
   sInstance = this;
 }
 
 void FakeDecryptor::Message(const std::string& aMessage) {
   MOZ_ASSERT(sInstance);
   const static std::string sid("fake-session-id");
   sInstance->mHost->OnSessionMessage(sid.c_str(), sid.size(),
--- a/dom/media/fake-cdm/cdm-test-decryptor.h
+++ b/dom/media/fake-cdm/cdm-test-decryptor.h
@@ -5,22 +5,24 @@
 
 #ifndef FAKE_DECRYPTOR_H__
 #define FAKE_DECRYPTOR_H__
 
 #include "content_decryption_module.h"
 #include <string>
 #include "mozilla/Attributes.h"
 
-class FakeDecryptor : public cdm::ContentDecryptionModule_9 {
+class FakeDecryptor : public cdm::ContentDecryptionModule_10 {
  public:
-  explicit FakeDecryptor(cdm::Host_9* aHost);
+  explicit FakeDecryptor(cdm::Host_10* aHost);
 
-  void Initialize(bool aAllowDistinctiveIdentifier,
-                  bool aAllowPersistentState) override {}
+  void Initialize(bool aAllowDistinctiveIdentifier, bool aAllowPersistentState,
+                  bool aUseHardwareSecureCodecs) override {
+    mHost->OnInitialized(true);
+  }
 
   void GetStatusForPolicy(uint32_t aPromiseId,
                           const cdm::Policy& aPolicy) override {}
 
   void SetServerCertificate(uint32_t aPromiseId,
                             const uint8_t* aServerCertificateData,
                             uint32_t aServerCertificateDataSize) override {}
 
@@ -40,42 +42,42 @@ class FakeDecryptor : public cdm::Conten
   void CloseSession(uint32_t aPromiseId, const char* aSessionId,
                     uint32_t aSessionIdSize) override {}
 
   void RemoveSession(uint32_t aPromiseId, const char* aSessionId,
                      uint32_t aSessionIdSize) override {}
 
   void TimerExpired(void* aContext) override {}
 
-  cdm::Status Decrypt(const cdm::InputBuffer_1& aEncryptedBuffer,
+  cdm::Status Decrypt(const cdm::InputBuffer_2& aEncryptedBuffer,
                       cdm::DecryptedBlock* aDecryptedBuffer) override {
     return cdm::Status::kDecodeError;
   }
 
   cdm::Status InitializeAudioDecoder(
-      const cdm::AudioDecoderConfig_1& aAudioDecoderConfig) override {
+      const cdm::AudioDecoderConfig_2& aAudioDecoderConfig) override {
     return cdm::Status::kDecodeError;
   }
 
   cdm::Status InitializeVideoDecoder(
-      const cdm::VideoDecoderConfig_1& aVideoDecoderConfig) override {
+      const cdm::VideoDecoderConfig_2& aVideoDecoderConfig) override {
     return cdm::Status::kDecodeError;
   }
 
   void DeinitializeDecoder(cdm::StreamType aDecoderType) override {}
 
   void ResetDecoder(cdm::StreamType aDecoderType) override {}
 
-  cdm::Status DecryptAndDecodeFrame(const cdm::InputBuffer_1& aEncryptedBuffer,
+  cdm::Status DecryptAndDecodeFrame(const cdm::InputBuffer_2& aEncryptedBuffer,
                                     cdm::VideoFrame* aVideoFrame) override {
     return cdm::Status::kDecodeError;
   }
 
   cdm::Status DecryptAndDecodeSamples(
-      const cdm::InputBuffer_1& aEncryptedBuffer,
+      const cdm::InputBuffer_2& aEncryptedBuffer,
       cdm::AudioFrames* aAudioFrame) override {
     return cdm::Status::kDecodeError;
   }
 
   void OnPlatformChallengeResponse(
       const cdm::PlatformChallengeResponse& aResponse) override {}
 
   void OnQueryOutputProtectionStatus(cdm::QueryResult aResult,
@@ -87,17 +89,17 @@ class FakeDecryptor : public cdm::Conten
 
   void Destroy() override {
     delete this;
     sInstance = nullptr;
   }
 
   static void Message(const std::string& aMessage);
 
-  cdm::Host_9* mHost;
+  cdm::Host_10* mHost;
 
   static FakeDecryptor* sInstance;
 
  private:
   virtual ~FakeDecryptor() {}
 
   void TestStorage();
 };
--- a/dom/media/fake-cdm/cdm-test-storage.cpp
+++ b/dom/media/fake-cdm/cdm-test-storage.cpp
@@ -30,17 +30,17 @@ class WriteRecordClient : public FileIOC
     }
   }
 
   void OnReadComplete(Status aStatus, const uint8_t* aData,
                       uint32_t aDataSize) override {}
 
   void OnWriteComplete(Status aStatus) override { Done(aStatus); }
 
-  void Do(const string& aName, Host_9* aHost) {
+  void Do(const string& aName, Host_10* aHost) {
     // Initialize the FileIO.
     mFileIO = aHost->CreateFileIO(this);
     mFileIO->Open(aName.c_str(), aName.size());
   }
 
  private:
   void Done(cdm::FileIOClient::Status aStatus) {
     // Note: Call Close() before running continuation, in case the
@@ -63,26 +63,26 @@ class WriteRecordClient : public FileIOC
   }
 
   FileIO* mFileIO = nullptr;
   function<void()> mOnSuccess;
   function<void()> mOnFailure;
   std::vector<uint8_t> mData;
 };
 
-void WriteRecord(Host_9* aHost, const std::string& aRecordName,
+void WriteRecord(Host_10* aHost, const std::string& aRecordName,
                  const uint8_t* aData, uint32_t aNumBytes,
                  function<void()>&& aOnSuccess, function<void()>&& aOnFailure) {
   // client will be delete in WriteRecordClient::Done
   WriteRecordClient* client = new WriteRecordClient(
       move(aOnSuccess), move(aOnFailure), aData, aNumBytes);
   client->Do(aRecordName, aHost);
 }
 
-void WriteRecord(Host_9* aHost, const std::string& aRecordName,
+void WriteRecord(Host_10* aHost, const std::string& aRecordName,
                  const std::string& aData, function<void()>&& aOnSuccess,
                  function<void()>&& aOnFailure) {
   return WriteRecord(aHost, aRecordName, (const uint8_t*)aData.c_str(),
                      aData.size(), move(aOnSuccess), move(aOnFailure));
 }
 
 class ReadRecordClient : public FileIOClient {
  public:
@@ -101,17 +101,17 @@ class ReadRecordClient : public FileIOCl
 
   void OnReadComplete(Status aStatus, const uint8_t* aData,
                       uint32_t aDataSize) override {
     Done(aStatus, aData, aDataSize);
   }
 
   void OnWriteComplete(Status aStatus) override {}
 
-  void Do(const string& aName, Host_9* aHost) {
+  void Do(const string& aName, Host_10* aHost) {
     mFileIO = aHost->CreateFileIO(this);
     mFileIO->Open(aName.c_str(), aName.size());
   }
 
  private:
   void Done(cdm::FileIOClient::Status aStatus, const uint8_t* aData,
             uint32_t aDataSize) {
     // Note: Call Close() before running continuation, in case the
@@ -133,17 +133,17 @@ class ReadRecordClient : public FileIOCl
     delete this;
   }
 
   FileIO* mFileIO = nullptr;
   function<void(bool, const uint8_t*, uint32_t)> mOnReadComplete;
 };
 
 void ReadRecord(
-    Host_9* aHost, const std::string& aRecordName,
+    Host_10* aHost, const std::string& aRecordName,
     function<void(bool, const uint8_t*, uint32_t)>&& aOnReadComplete) {
   // client will be delete in ReadRecordClient::Done
   ReadRecordClient* client = new ReadRecordClient(move(aOnReadComplete));
   client->Do(aRecordName, aHost);
 }
 
 class OpenRecordClient : public FileIOClient {
  public:
@@ -152,17 +152,17 @@ class OpenRecordClient : public FileIOCl
 
   void OnOpenComplete(Status aStatus) override { Done(aStatus); }
 
   void OnReadComplete(Status aStatus, const uint8_t* aData,
                       uint32_t aDataSize) override {}
 
   void OnWriteComplete(Status aStatus) override {}
 
-  void Do(const string& aName, Host_9* aHost) {
+  void Do(const string& aName, Host_10* aHost) {
     // Initialize the FileIO.
     mFileIO = aHost->CreateFileIO(this);
     mFileIO->Open(aName.c_str(), aName.size());
   }
 
  private:
   void Done(cdm::FileIOClient::Status aStatus) {
     // Note: Call Close() before running continuation, in case the
@@ -184,14 +184,14 @@ class OpenRecordClient : public FileIOCl
     delete this;
   }
 
   FileIO* mFileIO = nullptr;
   function<void(bool)> mOpenComplete;
   ;
 };
 
-void OpenRecord(Host_9* aHost, const std::string& aRecordName,
+void OpenRecord(Host_10* aHost, const std::string& aRecordName,
                 function<void(bool)>&& aOpenComplete) {
   // client will be delete in OpenRecordClient::Done
   OpenRecordClient* client = new OpenRecordClient(move(aOpenComplete));
   client->Do(aRecordName, aHost);
 }
--- a/dom/media/fake-cdm/cdm-test-storage.h
+++ b/dom/media/fake-cdm/cdm-test-storage.h
@@ -19,30 +19,30 @@
 
 class ReadContinuation {
  public:
   virtual ~ReadContinuation() {}
   virtual void operator()(bool aSuccess, const uint8_t* aData,
                           uint32_t aDataSize) = 0;
 };
 
-void WriteRecord(cdm::Host_9* aHost, const std::string& aRecordName,
+void WriteRecord(cdm::Host_10* aHost, const std::string& aRecordName,
                  const std::string& aData, std::function<void()>&& aOnSuccess,
                  std::function<void()>&& aOnFailure);
 
-void WriteRecord(cdm::Host_9* aHost, const std::string& aRecordName,
+void WriteRecord(cdm::Host_10* aHost, const std::string& aRecordName,
                  const uint8_t* aData, uint32_t aNumBytes,
                  std::function<void()>&& aOnSuccess,
                  std::function<void()>&& aOnFailure);
 
 void ReadRecord(
-    cdm::Host_9* aHost, const std::string& aRecordName,
+    cdm::Host_10* aHost, const std::string& aRecordName,
     std::function<void(bool, const uint8_t*, uint32_t)>&& aOnReadComplete);
 
 class OpenContinuation {
  public:
   virtual ~OpenContinuation() {}
   virtual void operator()(bool aSuccess) = 0;
 };
 
-void OpenRecord(cdm::Host_9* aHost, const std::string& aRecordName,
+void OpenRecord(cdm::Host_10* aHost, const std::string& aRecordName,
                 std::function<void(bool)>&& aOpenComplete);
 #endif  // TEST_CDM_STORAGE_H__
--- a/dom/media/fake-cdm/manifest.json
+++ b/dom/media/fake-cdm/manifest.json
@@ -1,9 +1,9 @@
 {
     "name": "fake",
     "description": "Fake CDM Plugin",
     "version": "1",
     "x-cdm-module-versions": "4",
-    "x-cdm-interface-versions": "9",
-    "x-cdm-host-versions": "9",
+    "x-cdm-interface-versions": "10",
+    "x-cdm-host-versions": "10",
     "x-cdm-codecs": ""
 }
\ No newline at end of file