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

Commit d0d32c0d authored by Vignesh Venkatasubramanian's avatar Vignesh Venkatasubramanian Committed by Lajos Molnar
Browse files

Pass VP9 Codec Specific Data from the Container

WebM container now has a provision to specify the VP9 Profile
and Level information in the container. Pass it to the Decoder as
Codec-Specific-Data. The software VP9 decoder will merely ignore
it.

Bug: 28152818
Bug: 28380207
Bug: 25684127

Change-Id: I77e2dc333093a346df6671e5f8d6d918ed45f7fb
parent 8ae73129
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ enum {
    kKeyOpusHeader        = 'ohdr',  // raw data
    kKeyOpusCodecDelay    = 'ocod',  // uint64_t (codec delay in ns)
    kKeyOpusSeekPreRoll   = 'ospr',  // uint64_t (seek preroll in ns)
    kKeyVp9CodecPrivate   = 'vp9p',  // raw data (vp9 csd information)
    kKeyWantsNALFragments = 'NALf',
    kKeyIsSyncFrame       = 'sync',  // int32_t (bool)
    kKeyIsCodecConfig     = 'conf',  // int32_t (bool)
+10 −0
Original line number Diff line number Diff line
@@ -527,6 +527,16 @@ status_t convertMetaDataToMessage(
        buffer->meta()->setInt32("csd", true);
        buffer->meta()->setInt64("timeUs", 0);
        msg->setBuffer("csd-2", buffer);
    } else if (meta->findData(kKeyVp9CodecPrivate, &type, &data, &size)) {
        sp<ABuffer> buffer = new (std::nothrow) ABuffer(size);
        if (buffer.get() == NULL || buffer->base() == NULL) {
            return NO_MEMORY;
        }
        memcpy(buffer->data(), data, size);

        buffer->meta()->setInt32("csd", true);
        buffer->meta()->setInt64("timeUs", 0);
        msg->setBuffer("csd-0", buffer);
    }

    // TODO expose "crypto-key"/kKeyCryptoKey through public api
+11 −0
Original line number Diff line number Diff line
@@ -228,6 +228,17 @@ void SoftVPX::onQueueFilled(OMX_U32 /* portIndex */) {

        BufferInfo *inInfo = *inQueue.begin();
        OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;

        // Software VP9 Decoder does not need the Codec Specific Data (CSD)
        // (specified in http://www.webmproject.org/vp9/profiles/). Ignore it if
        // it was passed.
        if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
            inQueue.erase(inQueue.begin());
            inInfo->mOwnedByUs = false;
            notifyEmptyBufferDone(inHeader);
            continue;
        }

        mTimeStamps[mTimeStampIdx] = inHeader->nTimeStamp;

        if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+7 −0
Original line number Diff line number Diff line
@@ -1113,6 +1113,13 @@ void MatroskaExtractor::addTracks() {
                    meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_VP8);
                } else if (!strcmp("V_VP9", codecID)) {
                    meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_VP9);
                    if (codecPrivateSize > 0) {
                      // 'csd-0' for VP9 is the Blob of Codec Private data as
                      // specified in http://www.webmproject.org/vp9/profiles/.
                      meta->setData(
                              kKeyVp9CodecPrivate, 0, codecPrivate,
                              codecPrivateSize);
                    }
                } else {
                    ALOGW("%s is not supported.", codecID);
                    continue;