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

Commit 5bbffc05 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "do string compare with mime immediately after we get the value" into lmp-dev

parents d42173a4 afc0a87c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -141,13 +141,17 @@ status_t NuPlayer::GenericSource::initFromDataSource() {
    int32_t totalBitrate = 0;

    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;