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

Commit 321d2134 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Bugfixes for Dolby Vision support"

parents c76250c8 83d46a44
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1082,9 +1082,14 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                        const uint8_t *ptr = (const uint8_t *)data;
                        const uint8_t profile = ptr[2] >> 1;
                        const uint8_t bl_compatibility_id = (ptr[4]) >> 4;
                        bool create_two_tracks = false;

                        if (bl_compatibility_id && bl_compatibility_id != 15) {
                            create_two_tracks = true;
                        }

                        if (4 == profile || 7 == profile ||
                                (profile >= 8 && profile < 11 && bl_compatibility_id)) {
                                (profile >= 8 && profile < 11 && create_two_tracks)) {
                            // we need a backward compatible track
                            ALOGV("Adding new backward compatible track");
                            Track *track_b = new Track;
@@ -2388,6 +2393,9 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
        }
        case FOURCC("dvcC"):
        case FOURCC("dvvC"): {

            CHECK_EQ(chunk_data_size, 24);

            auto buffer = heapbuffer<uint8_t>(chunk_data_size);

            if (buffer.get() == NULL) {
+18 −19
Original line number Diff line number Diff line
@@ -1909,13 +1909,11 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
            meta->setData(kKeyAV1C, 0, csd0->data(), csd0->size());
        } else if (mime == MEDIA_MIMETYPE_VIDEO_DOLBY_VISION) {
            if (msg->findBuffer("csd-2", &csd2)) {
                //dvcc should be 24
                if (csd2->size() == 24) {
                    meta->setData(kKeyDVCC, kTypeDVCC, csd2->data(), csd2->size());

                size_t dvcc_size = 1024;
                uint8_t dvcc[dvcc_size];
                memcpy(dvcc, csd2->data(), dvcc_size);
                    uint8_t *dvcc = csd2->data();
                    const uint8_t profile = dvcc[2] >> 1;

                    if (profile > 1 && profile < 9) {
                        std::vector<uint8_t> hvcc(csd0size + 1024);
                        size_t outsize = reassembleHVCC(csd0, hvcc.data(), hvcc.size(), 4);
@@ -1930,6 +1928,7 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
                            meta->setData(kKeyAVCC, kTypeAVCC, avcc.data(), outsize);
                        }
                    }
                }
            } else {
                ALOGW("We need csd-2!!. %s", msg->debugString().c_str());
            }