summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Huber <andih@google.com> 2011-07-19 15:04:53 -0700
committer Andreas Huber <andih@google.com> 2011-07-19 15:04:53 -0700
commit9073725c1b53eaa1930d28a4bffea8076ed2d314 (patch)
tree028159fa12bd60408b8a3da9bc06e7eb5bc40a92
parent7dde1c8ccce049378b8aa9e757b6f907040c8640 (diff)
More HLS fixes
properly expand URLs where the "new" URL is an absolute path. properly include any extra headers even when fetching the key files. Change-Id: I7cd8879015ea8e3d3e2334f4e7e16b8c1a5d48e9
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp5
-rw-r--r--media/libstagefright/httplive/M3UParser.cpp35
2 files changed, 30 insertions, 10 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 73b3d5b9a905..90d64baee10a 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -785,7 +785,10 @@ status_t LiveSession::decryptBuffer(
keySource->setUID(mUID);
}
- status_t err = keySource->connect(keyURI.c_str());
+ status_t err =
+ keySource->connect(
+ keyURI.c_str(),
+ mExtraHeaders.isEmpty() ? NULL : &mExtraHeaders);
if (err == OK) {
size_t offset = 0;
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index 123fbf8b23e4..9df9f59a8e26 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -106,21 +106,38 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
return true;
}
- size_t n = strlen(baseURL);
- if (baseURL[n - 1] == '/') {
- out->setTo(baseURL);
- out->append(url);
- } else {
- const char *slashPos = strrchr(baseURL, '/');
+ if (url[0] == '/') {
+ // URL is an absolute path.
+
+ char *protocolEnd = strstr(baseURL, "//") + 2;
+ char *pathStart = strchr(protocolEnd, '/');
- if (slashPos > &baseURL[6]) {
- out->setTo(baseURL, slashPos - baseURL);
+ if (pathStart != NULL) {
+ out->setTo(baseURL, pathStart - baseURL);
} else {
out->setTo(baseURL);
}
- out->append("/");
out->append(url);
+ } else {
+ // URL is a relative path
+
+ size_t n = strlen(baseURL);
+ if (baseURL[n - 1] == '/') {
+ out->setTo(baseURL);
+ out->append(url);
+ } else {
+ const char *slashPos = strrchr(baseURL, '/');
+
+ if (slashPos > &baseURL[6]) {
+ out->setTo(baseURL, slashPos - baseURL);
+ } else {
+ out->setTo(baseURL);
+ }
+
+ out->append("/");
+ out->append(url);
+ }
}
LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());