summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-04-19 11:50:27 -0700
committerAndreas Huber <andih@google.com>2011-04-20 09:22:06 -0700
commitad0d9c9c39a24b7fbd94e935a5855c9025341929 (patch)
tree1757b447d0d0ecb2d5d275dbb0506d3140939abc /media/libstagefright/httplive
parent7bf8413f91fc072452f315a91618aeef2574d420 (diff)
downloadframeworks_av-ad0d9c9c39a24b7fbd94e935a5855c9025341929.zip
frameworks_av-ad0d9c9c39a24b7fbd94e935a5855c9025341929.tar.gz
frameworks_av-ad0d9c9c39a24b7fbd94e935a5855c9025341929.tar.bz2
Add extra headers specified in the media player's setDataSource call
to all http requests made by the http live implementation. Change-Id: I9dd78bb261bc678ea98c82009ca2634b74f3cd58 related-to-bug: 4315346
Diffstat (limited to 'media/libstagefright/httplive')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 8e1bdf3..012d9ad 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -67,9 +67,17 @@ sp<DataSource> LiveSession::getDataSource() {
return mDataSource;
}
-void LiveSession::connect(const char *url) {
+void LiveSession::connect(
+ const char *url, const KeyedVector<String8, String8> *headers) {
sp<AMessage> msg = new AMessage(kWhatConnect, id());
msg->setString("url", url);
+
+ if (headers != NULL) {
+ msg->setPointer(
+ "headers",
+ new KeyedVector<String8, String8>(*headers));
+ }
+
msg->post();
}
@@ -144,6 +152,16 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
AString url;
CHECK(msg->findString("url", &url));
+ KeyedVector<String8, String8> *headers = NULL;
+ if (!msg->findPointer("headers", (void **)&headers)) {
+ mExtraHeaders.clear();
+ } else {
+ mExtraHeaders = *headers;
+
+ delete headers;
+ headers = NULL;
+ }
+
if (!(mFlags & kFlagIncognito)) {
LOGI("onConnect '%s'", url.c_str());
} else {
@@ -210,7 +228,8 @@ status_t LiveSession::fetchFile(const char *url, sp<ABuffer> *out) {
}
}
- status_t err = mHTTPDataSource->connect(url);
+ status_t err = mHTTPDataSource->connect(
+ url, mExtraHeaders.isEmpty() ? NULL : &mExtraHeaders);
if (err != OK) {
return err;