summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/chromium_http
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-30 11:15:27 -0700
committerAndreas Huber <andih@google.com>2011-03-30 11:15:27 -0700
commit6511c9755c3a3360ba869772600c7aae048a7ffc (patch)
tree2107391c77f03d89461e296703c856a32f9196c0 /media/libstagefright/chromium_http
parentff6bf33354f28a2bce073645bd102414c81d7580 (diff)
downloadframeworks_av-6511c9755c3a3360ba869772600c7aae048a7ffc.zip
frameworks_av-6511c9755c3a3360ba869772600c7aae048a7ffc.tar.gz
frameworks_av-6511c9755c3a3360ba869772600c7aae048a7ffc.tar.bz2
Stagefright DataSources now expose the underlying content mime type.
Use that mime type to determine if we should do upfront buffering at the start of playback and don't for audio streams to ensure playback starts fairly instantly. Change-Id: If21e36d1b024f0e5c723911bceadaa2e0307ab42 related-to-bug: 4090916
Diffstat (limited to 'media/libstagefright/chromium_http')
-rw-r--r--media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp11
-rw-r--r--media/libstagefright/chromium_http/support.cpp6
2 files changed, 15 insertions, 2 deletions
diff --git a/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp b/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
index 949a5e4..1096717 100644
--- a/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
+++ b/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
@@ -79,6 +79,7 @@ status_t ChromiumHTTPDataSource::connect_l(
}
mURI = uri;
+ mContentType = String8("application/octet-stream");
if (headers != NULL) {
mHeaders = *headers;
@@ -99,10 +100,12 @@ status_t ChromiumHTTPDataSource::connect_l(
return mState == CONNECTED ? OK : mIOResult;
}
-void ChromiumHTTPDataSource::onConnectionEstablished(int64_t contentSize) {
+void ChromiumHTTPDataSource::onConnectionEstablished(
+ int64_t contentSize, const char *contentType) {
Mutex::Autolock autoLock(mLock);
mState = CONNECTED;
mContentSize = (contentSize < 0) ? -1 : contentSize + mCurrentOffset;
+ mContentType = String8(contentType);
mCondition.broadcast();
}
@@ -314,6 +317,12 @@ String8 ChromiumHTTPDataSource::getUri() {
return String8(mURI.c_str());
}
+String8 ChromiumHTTPDataSource::getMIMEType() const {
+ Mutex::Autolock autoLock(mLock);
+
+ return mContentType;
+}
+
void ChromiumHTTPDataSource::clearDRMState_l() {
if (mDecryptHandle != NULL) {
// To release mDecryptHandle
diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp
index 7ac56e8..af2f6ac 100644
--- a/media/libstagefright/chromium_http/support.cpp
+++ b/media/libstagefright/chromium_http/support.cpp
@@ -253,7 +253,11 @@ void SfDelegate::OnResponseStarted(URLRequest *request) {
MY_LOGV(StringPrintf("response headers: %s", headers.c_str()).c_str());
- mOwner->onConnectionEstablished(request->GetExpectedContentSize());
+ std::string contentType;
+ request->GetResponseHeaderByName("Content-Type", &contentType);
+
+ mOwner->onConnectionEstablished(
+ request->GetExpectedContentSize(), contentType.c_str());
}
void SfDelegate::OnReadCompleted(URLRequest *request, int bytes_read) {