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

Commit 72bbbff2 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Stagefright DataSources now expose the underlying content mime type."

parents 70d3e260 6511c975
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -84,6 +84,8 @@ public:
        return String8();
        return String8();
    }
    }


    virtual String8 getMIMEType() const;

protected:
protected:
    virtual ~DataSource() {}
    virtual ~DataSource() {}


+24 −16
Original line number Original line Diff line number Diff line
@@ -1693,6 +1693,13 @@ status_t AwesomePlayer::finishSetDataSource_l() {


        dataSource = mCachedSource;
        dataSource = mCachedSource;


        String8 contentType = dataSource->getMIMEType();

        if (strncasecmp(contentType.string(), "audio/", 6)) {
            // We're not doing this for streams that appear to be audio-only
            // streams to ensure that even low bandwidth streams start
            // playing back fairly instantly.

            // We're going to prefill the cache before trying to instantiate
            // We're going to prefill the cache before trying to instantiate
            // the extractor below, as the latter is an operation that otherwise
            // the extractor below, as the latter is an operation that otherwise
            // could block on the datasource for a significant amount of time.
            // could block on the datasource for a significant amount of time.
@@ -1715,6 +1722,7 @@ status_t AwesomePlayer::finishSetDataSource_l() {
            }
            }


            mLock.lock();
            mLock.lock();
        }


        if (mFlags & PREPARE_CANCELLED) {
        if (mFlags & PREPARE_CANCELLED) {
            LOGI("Prepare cancelled while waiting for initial cache fill.");
            LOGI("Prepare cancelled while waiting for initial cache fill.");
+4 −0
Original line number Original line Diff line number Diff line
@@ -144,4 +144,8 @@ sp<DataSource> DataSource::CreateFromURI(
    return source;
    return source;
}
}


String8 DataSource::getMIMEType() const {
    return String8("application/octet-stream");
}

}  // namespace android
}  // namespace android
+4 −0
Original line number Original line Diff line number Diff line
@@ -493,4 +493,8 @@ String8 NuCachedSource2::getUri() {
    return mSource->getUri();
    return mSource->getUri();
}
}


String8 NuCachedSource2::getMIMEType() const {
    return mSource->getMIMEType();
}

}  // namespace android
}  // namespace android
+14 −0
Original line number Original line Diff line number Diff line
@@ -136,6 +136,7 @@ status_t NuHTTPDataSource::connect(
    unsigned port;
    unsigned port;


    mUri = uri;
    mUri = uri;
    mContentType = String8("application/octet-stream");


    bool https;
    bool https;
    if (!ParseURL(uri, &host, &port, &path, &https)) {
    if (!ParseURL(uri, &host, &port, &path, &https)) {
@@ -265,6 +266,15 @@ status_t NuHTTPDataSource::connect(
            }
            }
        }
        }


        {
            AString value;
            if (mHTTP.find_header_value("Content-Type", &value)) {
                mContentType = String8(value.c_str());
            } else {
                mContentType = String8("application/octet-stream");
            }
        }

        applyTimeoutResponse();
        applyTimeoutResponse();


        if (offset == 0) {
        if (offset == 0) {
@@ -564,4 +574,8 @@ String8 NuHTTPDataSource::getUri() {
    return mUri;
    return mUri;
}
}


String8 NuHTTPDataSource::getMIMEType() const {
    return mContentType;
}

}  // namespace android
}  // namespace android
Loading