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

Commit 77f101b3 authored by Martin Storsjo's avatar Martin Storsjo Committed by Lajos Molnar
Browse files

Translate codec specific data for mp4v-es for MediaMuxer

The existing translations for H264 and AAC are written too broadly,
matching any video or audio codec, while they in fact are very
specific for these codecs.

This fixes muxing mp4v-es into .mp4 files using MediaMuxer.

Bug: 17956215
Bug: http://b.android.com/90138
Change-Id: I7de04c5e517a1cde07c8fc18463053355d7cf6ae
parent 186e9c45
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -601,16 +601,18 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
    // reassemble the csd data into its original form
    sp<ABuffer> csd0;
    if (msg->findBuffer("csd-0", &csd0)) {
        if (mime.startsWith("video/")) { // do we need to be stricter than this?
        if (mime == MEDIA_MIMETYPE_VIDEO_AVC) {
            sp<ABuffer> csd1;
            if (msg->findBuffer("csd-1", &csd1)) {
                char avcc[1024]; // that oughta be enough, right?
                size_t outsize = reassembleAVCC(csd0, csd1, avcc);
                meta->setData(kKeyAVCC, kKeyAVCC, avcc, outsize);
            }
        } else if (mime.startsWith("audio/")) {
        } else if (mime == MEDIA_MIMETYPE_AUDIO_AAC || mime == MEDIA_MIMETYPE_VIDEO_MPEG4) {
            int csd0size = csd0->size();
            char esds[csd0size + 31];
            // The written ESDS is actually for an audio stream, but it's enough
            // for transporting the CSD to muxers.
            reassembleESDS(csd0, esds);
            meta->setData(kKeyESDS, kKeyESDS, esds, sizeof(esds));
        }