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

Commit a1991255 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "wifi-display: do not use HDCP's encryptNative method if its unsupported" into klp-dev

parents 7a4c2711 ec3acca4
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -46,6 +46,17 @@ struct IHDCP : public IInterface {
    // Request to shutdown the active HDCP session.
    virtual status_t shutdownAsync() = 0;

    // Returns the capability bitmask of this HDCP session.
    // Possible return values (please refer to HDCAPAPI.h):
    //   HDCP_CAPS_ENCRYPT: mandatory, meaning the HDCP module can encrypt
    //   from an input byte-array buffer to an output byte-array buffer
    //   HDCP_CAPS_ENCRYPT_NATIVE: the HDCP module supports encryption from
    //   a native buffer to an output byte-array buffer. The format of the
    //   input native buffer is specific to vendor's encoder implementation.
    //   It is the same format as that used by the encoder when
    //   "storeMetaDataInBuffers" extension is enabled on its output port.
    virtual uint32_t getCaps() = 0;

    // ENCRYPTION only:
    // Encrypt data according to the HDCP spec. "size" bytes of data are
    // available at "inData" (virtual address), "size" may not be a multiple
+16 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ enum {
    HDCP_SET_OBSERVER,
    HDCP_INIT_ASYNC,
    HDCP_SHUTDOWN_ASYNC,
    HDCP_GET_CAPS,
    HDCP_ENCRYPT,
    HDCP_ENCRYPT_NATIVE,
    HDCP_DECRYPT,
@@ -85,6 +86,13 @@ struct BpHDCP : public BpInterface<IHDCP> {
        return reply.readInt32();
    }

    virtual uint32_t getCaps() {
        Parcel data, reply;
        data.writeInterfaceToken(IHDCP::getInterfaceDescriptor());
        remote()->transact(HDCP_GET_CAPS, data, &reply);
        return reply.readInt32();
    }

    virtual status_t encrypt(
            const void *inData, size_t size, uint32_t streamCTR,
            uint64_t *outInputCTR, void *outData) {
@@ -222,6 +230,14 @@ status_t BnHDCP::onTransact(
            return OK;
        }

        case HDCP_GET_CAPS:
        {
            CHECK_INTERFACE(IHDCP, data, reply);

            reply->writeInt32(getCaps());
            return OK;
        }

        case HDCP_ENCRYPT:
        {
            size_t size = data.readInt32();
+14 −0
Original line number Diff line number Diff line
@@ -100,6 +100,20 @@ status_t HDCP::shutdownAsync() {
    return mHDCPModule->shutdownAsync();
}

uint32_t HDCP::getCaps() {
    Mutex::Autolock autoLock(mLock);

    if (mHDCPModule == NULL) {
        return NO_INIT;
    }

    // TO-DO:
    // Only support HDCP_CAPS_ENCRYPT (byte-array to byte-array) for now.
    // use mHDCPModule->getCaps() when the HDCP libraries get updated.
    //return mHDCPModule->getCaps();
    return HDCPModule::HDCP_CAPS_ENCRYPT;
}

status_t HDCP::encrypt(
        const void *inData, size_t size, uint32_t streamCTR,
        uint64_t *outInputCTR, void *outData) {
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ struct HDCP : public BnHDCP {
    virtual status_t setObserver(const sp<IHDCPObserver> &observer);
    virtual status_t initAsync(const char *host, unsigned port);
    virtual status_t shutdownAsync();
    virtual uint32_t getCaps();

    virtual status_t encrypt(
            const void *inData, size_t size, uint32_t streamCTR,
+2 −1
Original line number Diff line number Diff line
@@ -939,7 +939,8 @@ status_t WifiDisplaySource::PlaybackSession::addSource(
    if (isVideo) {
        format->setString("mime", MEDIA_MIMETYPE_VIDEO_AVC);
        format->setInt32("store-metadata-in-buffers", true);
        format->setInt32("store-metadata-in-buffers-output", (mHDCP != NULL));
        format->setInt32("store-metadata-in-buffers-output", (mHDCP != NULL)
                && (mHDCP->getCaps() & HDCPModule::HDCP_CAPS_ENCRYPT_NATIVE));
        format->setInt32(
                "color-format", OMX_COLOR_FormatAndroidOpaque);
        format->setInt32("profile-idc", profileIdc);