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

Commit 90da79a4 authored by Satya Krishna Pindiproli's avatar Satya Krishna Pindiproli Committed by Mingming Yin
Browse files

libstagefright: Instantiate FLACDecoder at runtime

Remove the entry corresponding to FLACDecoder from
media_codecs.xml and instantiate it in OMXCodec for
mimetype "audio/flac" at runtime.

Use Google's RAW decoder to support ACodec path as
FLACDecoder is not OMX compliant.

CRs-Fixed: 749235
Change-Id: Ia8842256d00dd53293335535d3b03a3beffb13aa
parent aa6c746a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -4663,8 +4663,15 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
                "OMX.qcom.audio.encoder.aac",  // OMX.qcom.audio.encoder.aac
                0,     // flags
                &matchingCodecs);
    }
    else
    } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_AUDIO_FLAC) && !encoder) {
        //use google's raw decoder
        OMXCodec::findMatchingCodecs(
                MEDIA_MIMETYPE_AUDIO_RAW,
                encoder, //createEncoder
                "OMX.google.raw.decoder",
                0, //flags
                &matchingCodecs);
    } else
        OMXCodec::findMatchingCodecs(
                mime.c_str(),
                encoder, // createEncoder
+15 −1
Original line number Diff line number Diff line
@@ -260,6 +260,15 @@ void OMXCodec::findMatchingCodecs(
        entry->mQuirks = 0;
        return;
    }

    if (matchComponentName && !strncmp("FLACDecoder", matchComponentName, 10)) {
            matchingCodecs->add();

            CodecNameAndQuirks *entry = &matchingCodecs->editItemAt(index);
            entry->mName = String8("FLACDecoder");
            entry->mQuirks = 0;
            return;
    }
#endif

    for (;;) {
@@ -383,6 +392,11 @@ sp<MediaSource> OMXCodec::Create(
    CHECK(success);

    Vector<CodecNameAndQuirks> matchingCodecs;

    if (!strncmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC, 10)) {
        findMatchingCodecs(mime, createEncoder,
            "FLACDecoder", flags, &matchingCodecs);
    } else
        findMatchingCodecs(
            mime, createEncoder, matchComponentName, flags, &matchingCodecs);