(This is a merge of http://go/wvgerrit/93829, http://go/wvgerrit/93830, http://go/wvgerrit/93832, http://go/wvgerrit/93833, and http://go/wvgerrit/93834 from the Widevine repo.) This implements the CDM code changes necessary to take advantage of Combined Decrypt Calls on OEMCrypto v16. The result of this is that WVCryptoPlugin is much lighter now because it can pass the full sample down to the core in one call, but CryptoSession is heavier, as it now has to handle more complex fallback logic when devices can't handle multiple subsamples at once. This patch also removes support for the 'cens' and 'cbc1' schema, which are being dropped in OEMCrypto v16. This fixes an overflow in the code for handling those schemas by removing it entirely. This patch also fixes the "in chunks" legacy decrypt path to use larger chunk sizes on devices with higher resource rating tiers. Bug: 135285640 Bug: 123435824 Bug: 138584971 Bug: 139257871 Bug: 78289910 Bug: 149361893 Test: no new CE CDM Unit Test failures Test: Google Play plays Test: Netflix plays Test: no new GTS failures Change-Id: Ic4952c9fa3bc7fd5ed08698e88254380a7a18514
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
//
|
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
//
|
|
|
|
#ifndef WV_CRYPTO_PLUGIN_H_
|
|
#define WV_CRYPTO_PLUGIN_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "utils/StrongPointer.h"
|
|
#include "utils/Vector.h"
|
|
|
|
#include "media/hardware/CryptoAPI.h"
|
|
#include "media/stagefright/foundation/ABase.h"
|
|
#include "media/stagefright/foundation/AString.h"
|
|
#include "wv_content_decryption_module.h"
|
|
|
|
namespace wvdrm {
|
|
|
|
class WVCryptoPlugin : public android::CryptoPlugin {
|
|
public:
|
|
WVCryptoPlugin(const void* data, size_t size,
|
|
const android::sp<wvcdm::WvContentDecryptionModule>& cdm);
|
|
virtual ~WVCryptoPlugin() {}
|
|
|
|
virtual bool requiresSecureDecoderComponent(const char* mime) const;
|
|
|
|
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 Pattern &pattern,
|
|
const void* srcPtr,
|
|
const SubSample* subSamples, size_t numSubSamples,
|
|
void* dstPtr, android::AString* errorDetailMsg);
|
|
|
|
private:
|
|
DISALLOW_EVIL_CONSTRUCTORS(WVCryptoPlugin);
|
|
|
|
android::sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
|
|
|
bool mTestMode;
|
|
wvcdm::CdmSessionId mSessionId;
|
|
|
|
wvcdm::CdmSessionId configureTestMode(const void* data, size_t size);
|
|
android::status_t attemptDecrypt(
|
|
const wvcdm::CdmDecryptionParametersV16& params,
|
|
bool haveEncryptedSubsamples, android::AString* errorDetailMsg);
|
|
};
|
|
|
|
} // namespace wvdrm
|
|
|
|
#endif // WV_CRYPTO_PLUGIN_H_
|