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

Commit b8d065aa authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6091187 from 8f72d008 to qt-qpr2-release

Change-Id: I33e175ef2035398744d91a23ddea7a41f9ad607c
parents d05aa2e5 8f72d008
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -797,37 +797,55 @@ Return<void> DrmPlugin::getSecureStopIds(getSecureStopIds_cb _hidl_cb) {
}

Return<Status> DrmPlugin::releaseSecureStops(const SecureStopRelease& ssRelease) {
    if (ssRelease.opaqueData.size() == 0) {
    // OpaqueData starts with 4 byte decimal integer string
    const size_t kFourBytesOffset = 4;
    if (ssRelease.opaqueData.size() < kFourBytesOffset) {
        ALOGE("Invalid secureStopRelease length");
        return Status::BAD_VALUE;
    }

    Status status = Status::OK;
    std::vector<uint8_t> input = toVector(ssRelease.opaqueData);

    if (input.size() < kSecureStopIdSize + kFourBytesOffset) {
        // The minimum size of SecureStopRelease has to contain
        // a 4 bytes count and one secureStop id
        ALOGE("Total size of secureStops is too short");
        return Status::BAD_VALUE;
    }

    // The format of opaqueData is shared between the server
    // and the drm service. The clearkey implementation consists of:
    //    count - number of secure stops
    //    list of fixed length secure stops
    size_t countBufferSize = sizeof(uint32_t);
    uint32_t count = 0;
    sscanf(reinterpret_cast<char*>(input.data()), "%04" PRIu32, &count);

    // Avoid divide by 0 below.
    if (count == 0) {
        ALOGE("Invalid 0 secureStop count");
        return Status::BAD_VALUE;
    }

    size_t secureStopSize = (input.size() - countBufferSize) / count;
    uint8_t buffer[secureStopSize];
    size_t offset = countBufferSize; // skip the count
    // Computes the fixed length secureStop size
    size_t secureStopSize = (input.size() - kFourBytesOffset) / count;
    if (secureStopSize < kSecureStopIdSize) {
        // A valid secureStop contains the id plus data
        ALOGE("Invalid secureStop size");
        return Status::BAD_VALUE;
    }
    uint8_t* buffer = new uint8_t[secureStopSize];
    size_t offset = kFourBytesOffset; // skip the count
    for (size_t i = 0; i < count; ++i, offset += secureStopSize) {
        memcpy(buffer, input.data() + offset, secureStopSize);
        std::vector<uint8_t> id(buffer, buffer + kSecureStopIdSize);

        // A secureStop contains id+data, we only use the id for removal
        std::vector<uint8_t> id(buffer, buffer + kSecureStopIdSize);
        status = removeSecureStop(toHidlVec(id));
        if (Status::OK != status) break;
    }

    delete[] buffer;
    return status;
}

+8 −4
Original line number Diff line number Diff line
@@ -1339,10 +1339,14 @@ status_t BnAudioFlinger::onTransact(
        }
        case GET_EFFECT_DESCRIPTOR: {
            CHECK_INTERFACE(IAudioFlinger, data, reply);
            effect_uuid_t uuid;
            data.read(&uuid, sizeof(effect_uuid_t));
            effect_uuid_t type;
            data.read(&type, sizeof(effect_uuid_t));
            effect_uuid_t uuid = {};
            if (data.read(&uuid, sizeof(effect_uuid_t)) != NO_ERROR) {
                android_errorWriteLog(0x534e4554, "139417189");
            }
            effect_uuid_t type = {};
            if (data.read(&type, sizeof(effect_uuid_t)) != NO_ERROR) {
                android_errorWriteLog(0x534e4554, "139417189");
            }
            uint32_t preferredTypeFlag = data.readUint32();
            effect_descriptor_t desc = {};
            status_t status = getEffectDescriptor(&uuid, &type, preferredTypeFlag, &desc);
+12 −9
Original line number Diff line number Diff line
@@ -130,21 +130,24 @@ void NuPlayer::StreamingSource::onReadBuffer() {
        } else if (n < 0) {
            break;
        } else {
            if (buffer[0] == 0x00) {
            if (buffer[0] == 0x00) { // OK to access buffer[0] since n must be > 0 here
                // XXX legacy

                if (extra == NULL) {
                    extra = new AMessage;
                }

                uint8_t type = buffer[1];
                uint8_t type = 0;
                if (n > 1) {
                    type = buffer[1];

                if (type & 2) {
                    if ((type & 2) && (n >= 2 + sizeof(int64_t))) {
                        int64_t mediaTimeUs;
                        memcpy(&mediaTimeUs, &buffer[2], sizeof(mediaTimeUs));

                        extra->setInt64(kATSParserKeyMediaTimeUs, mediaTimeUs);
                    }
                }

                mTSParser->signalDiscontinuity(
                        ((type & 1) == 0)
@@ -152,7 +155,7 @@ void NuPlayer::StreamingSource::onReadBuffer() {
                                : ATSParser::DISCONTINUITY_FORMATCHANGE,
                        extra);
            } else {
                status_t err = mTSParser->feedTSPacket(buffer, sizeof(buffer));
                status_t err = mTSParser->feedTSPacket(buffer, n);

                if (err != OK) {
                    ALOGE("TS Parser returned error %d", err);