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

Commit 68c8401d authored by Amit Shekhar's avatar Amit Shekhar Committed by Steve Kondik
Browse files

libstagefright: Fix incorrect comparison of mimetype

'sizeof' is used to calculate length of string constant which returns
size of pointer to string constant. This causes comparison of only
four characters of mimetype. By using strlen, entire mimetype string
is compared - which returns correct result.

Change-Id: I4d081d3452f167d49aebbe3219e8e522ec29d5be
CRs-Fixed: 664311
parent 200ee25e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -469,14 +469,14 @@ status_t ExtendedCodec::getSupportedAudioFormatInfo(
        int portIndex,
        int* channelCount) {
    status_t retVal = OK;
    if (!strcmp(mime->c_str(),MEDIA_MIMETYPE_AUDIO_QCELP)) {
    if (!strncmp(mime->c_str(), MEDIA_MIMETYPE_AUDIO_QCELP, strlen(MEDIA_MIMETYPE_AUDIO_QCELP))) {
        OMX_AUDIO_PARAM_QCELP13TYPE params;
        InitOMXParams(&params);
        params.nPortIndex = portIndex;
        CHECK_EQ(OMXhandle->getParameter(
                   nodeID, OMX_IndexParamAudioQcelp13, &params, sizeof(params)), (status_t)OK);
        *channelCount = params.nChannels;
    } else if(!strcmp(mime->c_str(), MEDIA_MIMETYPE_AUDIO_EVRC)) {
    } else if(!strncmp(mime->c_str(), MEDIA_MIMETYPE_AUDIO_EVRC, strlen(MEDIA_MIMETYPE_AUDIO_EVRC))) {
        OMX_AUDIO_PARAM_EVRCTYPE params;
        InitOMXParams(&params);
        params.nPortIndex = portIndex;
@@ -1136,8 +1136,8 @@ bool ExtendedCodec::useHWAACDecoder(const char *mime) {
    char value[PROPERTY_VALUE_MAX] = {0};
    int aaccodectype = 0;
    aaccodectype = property_get("media.aaccodectype", value, NULL);
    if (aaccodectype && !strncmp("0", value, 1) &&
        !strncmp(mime, MEDIA_MIMETYPE_AUDIO_AAC,sizeof(MEDIA_MIMETYPE_AUDIO_AAC))) {
    if (aaccodectype && !strncmp("1", value, 1) &&
        !strncmp(mime, MEDIA_MIMETYPE_AUDIO_AAC, strlen(MEDIA_MIMETYPE_AUDIO_AAC))) {
        ALOGI("Using Hardware AAC Decoder");
        return true;
    }