summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/rtsp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2014-03-14 17:53:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-14 17:53:13 +0000
commitbeb57a5a08207af80180b93dd80d611a85997c43 (patch)
treecf330325115cc3dbb64a934c1b95cf58fdcc6235 /media/libstagefright/rtsp
parent59892ddb5254a3b38c8efca6c4c70722d4b942e6 (diff)
parentf1ac623fcc6bbda2faff9752cd611182a897afe1 (diff)
downloadframeworks_av-beb57a5a08207af80180b93dd80d611a85997c43.zip
frameworks_av-beb57a5a08207af80180b93dd80d611a85997c43.tar.gz
frameworks_av-beb57a5a08207af80180b93dd80d611a85997c43.tar.bz2
am f1ac623f: am 4a67fc49: Merge "Implemented support for RTSP 301 Redirect"
* commit 'f1ac623fcc6bbda2faff9752cd611182a897afe1': Implemented support for RTSP 301 Redirect
Diffstat (limited to 'media/libstagefright/rtsp')
-rw-r--r--media/libstagefright/rtsp/MyHandler.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 16549ff..f3dfc59 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -488,21 +488,32 @@ struct MyHandler : public AHandler {
sp<ARTSPResponse> response =
static_cast<ARTSPResponse *>(obj.get());
- if (response->mStatusCode == 302) {
+ if (response->mStatusCode == 301 || response->mStatusCode == 302) {
ssize_t i = response->mHeaders.indexOfKey("location");
CHECK_GE(i, 0);
- mSessionURL = response->mHeaders.valueAt(i);
-
- AString request;
- request = "DESCRIBE ";
- request.append(mSessionURL);
- request.append(" RTSP/1.0\r\n");
- request.append("Accept: application/sdp\r\n");
- request.append("\r\n");
+ mOriginalSessionURL = response->mHeaders.valueAt(i);
+ mSessionURL = mOriginalSessionURL;
+
+ // Strip any authentication info from the session url, we don't
+ // want to transmit user/pass in cleartext.
+ AString host, path, user, pass;
+ unsigned port;
+ if (ARTSPConnection::ParseURL(
+ mSessionURL.c_str(), &host, &port, &path, &user, &pass)
+ && user.size() > 0) {
+ mSessionURL.clear();
+ mSessionURL.append("rtsp://");
+ mSessionURL.append(host);
+ mSessionURL.append(":");
+ mSessionURL.append(StringPrintf("%u", port));
+ mSessionURL.append(path);
+
+ ALOGI("rewritten session url: '%s'", mSessionURL.c_str());
+ }
- sp<AMessage> reply = new AMessage('desc', id());
- mConn->sendRequest(request.c_str(), reply);
+ sp<AMessage> reply = new AMessage('conn', id());
+ mConn->connect(mOriginalSessionURL.c_str(), reply);
break;
}