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

Commit 8b7552e4 authored by Malathi Gottam's avatar Malathi Gottam Committed by Gopalakrishnan Nallasamy
Browse files

MediaAppender:File fmt mime to determine extractor

Instead of extractor name check, obtain mime from extracted file format.
Use this mime info to limit mediaappend to only .mp4 files.

Bug: 193487901

Test: atest android.mediav2.cts.MuxerTest

Change-Id: I40c3caad74b1e595525611951d005da413f4eadb
parent fbdfa069
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -75,10 +75,21 @@ status_t MediaAppender::init() {
        return status;
    }

    if (strcmp("MPEG4Extractor", mExtractor->getName()) == 0) {
    sp<AMessage> fileFormat;
    status = mExtractor->getFileFormat(&fileFormat);
    if (status != OK) {
        ALOGE("extractor_getFileFormat failed, status :%d", status);
        return status;
    }

    AString fileMime;
    fileFormat->findString("mime", &fileMime);
    // only compare the end of the file MIME type to allow for vendor customized mime type
    if (fileMime.endsWith("mp4")){
        mFormat = MediaMuxer::OUTPUT_FORMAT_MPEG_4;
    } else {
        ALOGE("Unsupported format, extractor name:%s", mExtractor->getName());
        ALOGE("Unsupported file format, extractor name:%s, fileformat %s",
              mExtractor->getName(), fileMime.c_str());
        return ERROR_UNSUPPORTED;
    }