Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31682cd2 authored by Edwin Wong's avatar Edwin Wong Committed by Android (Google) Code Review
Browse files

Merge "Fix AMediaDrm_getKeyRequest which fails clearkey InitDataParser::parse...

Merge "Fix AMediaDrm_getKeyRequest which fails clearkey InitDataParser::parse test." into nyc-mr1-dev
parents a930117e 01a977aa
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include "DrmPlugin.h"
#include "ClearKeyUUID.h"
#include "MimeType.h"
#include "SessionLibrary.h"

namespace clearkeydrm {
@@ -32,10 +33,14 @@ bool DrmFactory::isCryptoSchemeSupported(const uint8_t uuid[16]) {
    return isClearKeyUUID(uuid);
}

bool DrmFactory::isContentTypeSupported(const android::String8 &initDataType) {
bool DrmFactory::isContentTypeSupported(const android::String8 &type) {
    // This should match the types handed by InitDataParser.
    return initDataType == "cenc" ||
           initDataType == "webm";
    return type == kIsoBmffVideoMimeType ||
        type == kIsoBmffAudioMimeType ||
        type == kCencInitDataFormat ||
        type == kWebmVideoMimeType ||
        type == kWebmAudioMimeType ||
        type == kWebmInitDataFormat;
}

android::status_t DrmFactory::createDrmPlugin(
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public:

    virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]);

    virtual bool isContentTypeSupported(const android::String8 &initDataType);
    virtual bool isContentTypeSupported(const android::String8 &mimeType);

    virtual android::status_t createDrmPlugin(
            const uint8_t uuid[16], android::DrmPlugin** plugin);
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ status_t DrmPlugin::closeSession(const Vector<uint8_t>& sessionId) {
status_t DrmPlugin::getKeyRequest(
        const Vector<uint8_t>& scope,
        const Vector<uint8_t>& initData,
        const String8& initDataType,
        const String8& mimeType,
        KeyType keyType,
        const KeyedVector<String8, String8>& optionalParameters,
        Vector<uint8_t>& request,
@@ -62,7 +62,7 @@ status_t DrmPlugin::getKeyRequest(
    if (!session.get()) {
        return android::ERROR_DRM_SESSION_NOT_OPENED;
    }
    return session->getKeyRequest(initData, initDataType, &request);
    return session->getKeyRequest(initData, mimeType, &request);
}

status_t DrmPlugin::provideKeyResponse(
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public:

    virtual status_t getKeyRequest(
            const Vector<uint8_t>& scope,
            const Vector<uint8_t>& initData,
            const Vector<uint8_t>& mimeType,
            const String8& initDataType,
            KeyType keyType,
            const KeyedVector<String8, String8>& optionalParameters,
+8 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include "InitDataParser.h"

#include "ClearKeyUUID.h"
#include "MimeType.h"
#include "Utils.h"

namespace clearkeydrm {
@@ -41,16 +42,20 @@ namespace {
}

android::status_t InitDataParser::parse(const Vector<uint8_t>& initData,
        const String8& initDataType,
        const String8& type,
        Vector<uint8_t>* licenseRequest) {
    // Build a list of the key IDs
    Vector<const uint8_t*> keyIds;
    if (initDataType == "cenc") {
    if (type == kIsoBmffVideoMimeType ||
        type == kIsoBmffAudioMimeType ||
        type == kCencInitDataFormat) {
        android::status_t res = parsePssh(initData, &keyIds);
        if (res != android::OK) {
            return res;
        }
    } else if (initDataType == "webm") {
    } else if (type == kWebmVideoMimeType ||
        type == kWebmAudioMimeType ||
        type == kWebmInitDataFormat) {
        // WebM "init data" is just a single key ID
        if (initData.size() != kKeyIdSize) {
            return android::ERROR_DRM_CANNOT_HANDLE;
Loading