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

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

Merge "Do not crash on missing mime type"

parents 471ab966 25cb3ca8
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -60,21 +60,23 @@ void AnotherPacketSource::setFormat(const sp<MetaData> &meta) {

    mIsAudio = false;
    mIsVideo = false;
    const char *mime;

    if (meta == NULL) {
    // Do not use meta if no mime.
    if (meta == NULL || !meta->findCString(kKeyMIMEType, &mime)) {
        return;
    }

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

    if (!strncasecmp("audio/", mime, 6)) {
        mIsAudio = true;
    } else if (!strncasecmp("video/", mime, 6)) {
        mIsVideo = true;
    } else if (!strncasecmp("text/", mime, 5) || !strncasecmp("application/", mime, 12)) {
        return;
    } else {
        CHECK(!strncasecmp("text/", mime, 5) || !strncasecmp("application/", mime, 12));
        ALOGW("Unsupported mime type: %s", mime);
    }
}