Allow Setting of Session ID

Implements the optional setMediaDrmSession() method. To enble this,
support was added to the core to report if a session ID is valid.

As a consequence of this, in the tests for the CryptoPlugin,
construction of the plugin must be deferred until all gMock
expectations are set, as construction now calls into the CDM core.

This is a merge of two changes from the Widevine CDM repo:
http://go/wvgerrit/14083
  Allow Setting of Session ID
http://go/wvgerrit/14085
  Check If Session ID Is Valid When Changing CryptoPlugin IDs

Bug: 19570317
Change-Id: I7dbd777ce6efebd71fdb5e602663a0e35a48a9c4
This commit is contained in:
John "Juce" Bruce
2015-04-10 15:59:11 -07:00
parent 0540770280
commit c5f576585b
8 changed files with 167 additions and 15 deletions

View File

@@ -7,6 +7,8 @@
#include <stdint.h>
#include "utils/Vector.h"
#include "media/hardware/CryptoAPI.h"
#include "media/stagefright/foundation/ABase.h"
#include "media/stagefright/foundation/AString.h"
@@ -24,6 +26,9 @@ class WVCryptoPlugin : public android::CryptoPlugin {
virtual void notifyResolution(uint32_t width, uint32_t height);
virtual android::status_t setMediaDrmSession(
const android::Vector<uint8_t>& sessionId);
virtual ssize_t decrypt(bool secure, const uint8_t key[16],
const uint8_t iv[16], Mode mode, const void* srcPtr,
const SubSample* subSamples, size_t numSubSamples,
@@ -35,7 +40,7 @@ class WVCryptoPlugin : public android::CryptoPlugin {
wvcdm::WvContentDecryptionModule* const mCDM;
bool mTestMode;
const wvcdm::CdmSessionId mSessionId;
wvcdm::CdmSessionId mSessionId;
wvcdm::CdmSessionId configureTestMode(const void* data, size_t size);
static void incrementIV(uint64_t increaseBy, std::vector<uint8_t>* ivPtr);