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

Commit afc0a87c authored by Chong Zhang's avatar Chong Zhang
Browse files

do string compare with mime immediately after we get the value

Bug: 17210803
Change-Id: I4d20dd4b95d18251c18a371bd8f89b1320b38879
parent 111333ea
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -134,13 +134,17 @@ status_t NuPlayer::GenericSource::initFromDataSource(
    }

    for (size_t i = 0; i < extractor->countTracks(); ++i) {
        sp<MediaSource> track = extractor->getTrack(i);

        sp<MetaData> meta = extractor->getTrackMetaData(i);

        const char *mime;
        CHECK(meta->findCString(kKeyMIMEType, &mime));

        sp<MediaSource> track = extractor->getTrack(i);

        // Do the string compare immediately with "mime",
        // we can't assume "mime" would stay valid after another
        // extractor operation, some extractors might modify meta
        // during getTrack() and make it invalid.
        if (!strncasecmp(mime, "audio/", 6)) {
            if (mAudioTrack.mSource == NULL) {
                mAudioTrack.mIndex = i;