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

Commit 5bae3d6b authored by Vignesh Venkatasubramanian's avatar Vignesh Venkatasubramanian Committed by Android (Google) Code Review
Browse files

Merge "libstagefright/webm: Add support for VP9 in webm muxer"

parents 26736fd2 70b22a02
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ sp<WebmElement> WebmElement::AudioTrackEntry(
}

sp<WebmElement> WebmElement::VideoTrackEntry(
        const char *codec,
        uint64_t width,
        uint64_t height,
        uint64_t uid,
@@ -353,7 +354,7 @@ sp<WebmElement> WebmElement::VideoTrackEntry(
            uid,
            lacing,
            lang,
            "V_VP8",
            codec,
            kVideoType,
            trackEntryFields);

+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ struct WebmElement : public LightRefBase<WebmElement> {
            const char *lang = "und");

    static sp<WebmElement> VideoTrackEntry(
            const char *codec,
            uint64_t width,
            uint64_t height,
            uint64_t uid = 0,
+22 −3
Original line number Diff line number Diff line
@@ -83,9 +83,25 @@ WebmWriter::WebmWriter(int fd)
// static
sp<WebmElement> WebmWriter::videoTrack(const sp<MetaData>& md) {
    int32_t width, height;
    const char *mimeType;
    CHECK(md->findInt32(kKeyWidth, &width));
    CHECK(md->findInt32(kKeyHeight, &height));
    return WebmElement::VideoTrackEntry(width, height);
    CHECK(md->findCString(kKeyMIMEType, &mimeType));
    const char *codec;
    if (!strncasecmp(
            mimeType,
            MEDIA_MIMETYPE_VIDEO_VP8,
            strlen(MEDIA_MIMETYPE_VIDEO_VP8))) {
        codec = "V_VP8";
    } else if (!strncasecmp(
            mimeType,
            MEDIA_MIMETYPE_VIDEO_VP9,
            strlen(MEDIA_MIMETYPE_VIDEO_VP9))) {
        codec = "V_VP9";
    } else {
        CHECK(!"Unsupported codec");
    }
    return WebmElement::VideoTrackEntry(codec, width, height);
}

// static
@@ -348,15 +364,18 @@ status_t WebmWriter::addSource(const sp<IMediaSource> &source) {
    const char *mime;
    source->getFormat()->findCString(kKeyMIMEType, &mime);
    const char *vp8 = MEDIA_MIMETYPE_VIDEO_VP8;
    const char *vp9 = MEDIA_MIMETYPE_VIDEO_VP9;
    const char *vorbis = MEDIA_MIMETYPE_AUDIO_VORBIS;

    size_t streamIndex;
    if (!strncasecmp(mime, vp8, strlen(vp8))) {
    if (!strncasecmp(mime, vp8, strlen(vp8)) ||
        !strncasecmp(mime, vp9, strlen(vp9))) {
        streamIndex = kVideoIndex;
    } else if (!strncasecmp(mime, vorbis, strlen(vorbis))) {
        streamIndex = kAudioIndex;
    } else {
        ALOGE("Track (%s) other than %s or %s is not supported", mime, vp8, vorbis);
        ALOGE("Track (%s) other than %s, %s or %s is not supported",
              mime, vp8, vp9, vorbis);
        return ERROR_UNSUPPORTED;
    }