(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
84 lines
2.3 KiB
C++
84 lines
2.3 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 <android/hidl/memory/1.0/IMemory.h>
|
|
|
|
#include "HidlTypes.h"
|
|
#include "wv_content_decryption_module.h"
|
|
#include "WVTypes.h"
|
|
|
|
namespace wvdrm {
|
|
namespace hardware {
|
|
namespace drm {
|
|
namespace V1_2 {
|
|
namespace widevine {
|
|
|
|
using ::android::hidl::memory::V1_0::IMemory;
|
|
|
|
struct WVCryptoPlugin : public ICryptoPlugin {
|
|
WVCryptoPlugin(const void* data, size_t size,
|
|
const sp<wvcdm::WvContentDecryptionModule>& cdm);
|
|
virtual ~WVCryptoPlugin() {}
|
|
|
|
Return<bool> requiresSecureDecoderComponent(const hidl_string& mime)
|
|
override;
|
|
|
|
Return<void> notifyResolution(uint32_t width, uint32_t height) override;
|
|
|
|
Return<Status> setMediaDrmSession(const hidl_vec<uint8_t>& sessionId)
|
|
override;
|
|
|
|
Return<void> setSharedBufferBase(const hidl_memory& base,
|
|
uint32_t bufferId) override;
|
|
|
|
Return<void> decrypt(
|
|
bool secure,
|
|
const hidl_array<uint8_t, 16>& keyId,
|
|
const hidl_array<uint8_t, 16>& iv,
|
|
Mode mode,
|
|
const Pattern& pattern,
|
|
const hidl_vec<SubSample>& subSamples,
|
|
const SharedBuffer& source,
|
|
uint64_t offset,
|
|
const DestinationBuffer& destination,
|
|
decrypt_cb _hidl_cb) override;
|
|
|
|
Return<void> decrypt_1_2(
|
|
bool secure,
|
|
const hidl_array<uint8_t, 16>& keyId,
|
|
const hidl_array<uint8_t, 16>& iv,
|
|
Mode mode,
|
|
const Pattern& pattern,
|
|
const hidl_vec<SubSample>& subSamples,
|
|
const SharedBuffer& source,
|
|
uint64_t offset,
|
|
const DestinationBuffer& destination,
|
|
decrypt_1_2_cb _hidl_cb) override;
|
|
|
|
private:
|
|
WVDRM_DISALLOW_COPY_AND_ASSIGN_AND_NEW(WVCryptoPlugin);
|
|
|
|
wvcdm::CdmSessionId mSessionId;
|
|
std::map<uint32_t, sp<IMemory> > mSharedBufferMap;
|
|
|
|
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
|
|
|
Status_V1_2 attemptDecrypt(
|
|
const wvcdm::CdmDecryptionParametersV16& params,
|
|
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
|
|
};
|
|
|
|
} // namespace widevine
|
|
} // namespace V1_2
|
|
} // namespace drm
|
|
} // namespace hardware
|
|
} // namespace wvdrm
|
|
|
|
#endif // WV_CRYPTO_PLUGIN_H_
|