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

Commit f6bfa550 authored by Chong Zhang's avatar Chong Zhang Committed by Android Git Automerger
Browse files

am 26156231: Merge "make NuPlayer\'s http connection mechanism behave more...

am 26156231: Merge "make NuPlayer\'s http connection mechanism behave more like that of AwesomePlayer\'s" into lmp-dev

* commit '26156231':
  make NuPlayer's http connection mechanism behave more like that of AwesomePlayer's
parents 8e57a02f 26156231
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -209,26 +209,30 @@ sp<DataSource> DataSource::CreateFromURI(
            uri = tmp.string();
        }

        if (httpSource->connect(uri, headers) != OK) {
            ALOGE("Failed to connect http source!");
            return NULL;
        }

        if (!isWidevine) {
        String8 cacheConfig;
        bool disconnectAtHighwatermark;
        KeyedVector<String8, String8> nonCacheSpecificHeaders;
        if (headers != NULL) {
                KeyedVector<String8, String8> copy = *headers;
            nonCacheSpecificHeaders = *headers;
            NuCachedSource2::RemoveCacheSpecificHeaders(
                        &copy, &cacheConfig, &disconnectAtHighwatermark);
                    &nonCacheSpecificHeaders,
                    &cacheConfig,
                    &disconnectAtHighwatermark);
        }

            sp<NuCachedSource2> cachedSource = new NuCachedSource2(
                    httpSource,
                    cacheConfig.isEmpty() ? NULL : cacheConfig.string());
        if (httpSource->connect(uri, &nonCacheSpecificHeaders) != OK) {
            ALOGE("Failed to connect http source!");
            return NULL;
        }

        if (!isWidevine) {
            String8 contentType = httpSource->getMIMEType();

            sp<NuCachedSource2> cachedSource = new NuCachedSource2(
                    httpSource,
                    cacheConfig.isEmpty() ? NULL : cacheConfig.string(),
                    disconnectAtHighwatermark);

            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