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

Commit e0e8223c authored by Jeff Tinker's avatar Jeff Tinker Committed by Android Git Automerger
Browse files

am 1cf9ad1a: Merge "Pass resolution to Crypto plugin on format change" into lmp-mr1-dev

* commit '1cf9ad1a':
  Pass resolution to Crypto plugin on format change
parents 7ed62fb4 1cf9ad1a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -41,6 +41,8 @@ struct ICrypto : public IInterface {
    virtual bool requiresSecureDecoderComponent(
    virtual bool requiresSecureDecoderComponent(
            const char *mime) const = 0;
            const char *mime) const = 0;


    virtual void notifyResolution(uint32_t width, uint32_t height) = 0;

    virtual ssize_t decrypt(
    virtual ssize_t decrypt(
            bool secure,
            bool secure,
            const uint8_t key[16],
            const uint8_t key[16],
@@ -64,4 +66,3 @@ struct BnCrypto : public BnInterface<ICrypto> {
}  // namespace android
}  // namespace android


#endif // ANDROID_ICRYPTO_H_
#endif // ANDROID_ICRYPTO_H_
+21 −1
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ enum {
    DESTROY_PLUGIN,
    DESTROY_PLUGIN,
    REQUIRES_SECURE_COMPONENT,
    REQUIRES_SECURE_COMPONENT,
    DECRYPT,
    DECRYPT,
    NOTIFY_RESOLUTION,
};
};


struct BpCrypto : public BpInterface<ICrypto> {
struct BpCrypto : public BpInterface<ICrypto> {
@@ -149,6 +150,15 @@ struct BpCrypto : public BpInterface<ICrypto> {
        return result;
        return result;
    }
    }


    virtual void notifyResolution(
        uint32_t width, uint32_t height) {
        Parcel data, reply;
        data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
        data.writeInt32(width);
        data.writeInt32(height);
        remote()->transact(NOTIFY_RESOLUTION, data, &reply);
    }

private:
private:
    DISALLOW_EVIL_CONSTRUCTORS(BpCrypto);
    DISALLOW_EVIL_CONSTRUCTORS(BpCrypto);
};
};
@@ -290,10 +300,20 @@ status_t BnCrypto::onTransact(
            return OK;
            return OK;
        }
        }


        case NOTIFY_RESOLUTION:
        {
            CHECK_INTERFACE(ICrypto, data, reply);

            int32_t width = data.readInt32();
            int32_t height = data.readInt32();
            notifyResolution(width, height);

            return OK;
        }

        default:
        default:
            return BBinder::onTransact(code, data, reply, flags);
            return BBinder::onTransact(code, data, reply, flags);
    }
    }
}
}


}  // namespace android
}  // namespace android
+8 −0
Original line number Original line Diff line number Diff line
@@ -257,4 +257,12 @@ ssize_t Crypto::decrypt(
            errorDetailMsg);
            errorDetailMsg);
}
}


void Crypto::notifyResolution(uint32_t width, uint32_t height) {
    Mutex::Autolock autoLock(mLock);

    if (mInitCheck == OK && mPlugin != NULL) {
        mPlugin->notifyResolution(width, height);
    }
}

}  // namespace android
}  // namespace android
+2 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,8 @@ struct Crypto : public BnCrypto {
    virtual bool requiresSecureDecoderComponent(
    virtual bool requiresSecureDecoderComponent(
            const char *mime) const;
            const char *mime) const;


    virtual void notifyResolution(uint32_t width, uint32_t height);

    virtual ssize_t decrypt(
    virtual ssize_t decrypt(
            bool secure,
            bool secure,
            const uint8_t key[16],
            const uint8_t key[16],
+10 −0
Original line number Original line Diff line number Diff line
@@ -1011,6 +1011,16 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                        mFlags |= kFlagOutputFormatChanged;
                        mFlags |= kFlagOutputFormatChanged;
                        postActivityNotificationIfPossible();
                        postActivityNotificationIfPossible();
                    }
                    }

                    // Notify mCrypto of video resolution changes
                    if (mCrypto != NULL) {
                      int32_t height, width;
                      if (mOutputFormat->findInt32("height", &height) &&
                          mOutputFormat->findInt32("width", &width)) {
                        mCrypto->notifyResolution(width, height);
                      }
                    }

                    break;
                    break;
                }
                }