diff options
author | Måns Zigher <mans.zigher@sonyericsson.com> | 2013-01-23 14:48:57 +0100 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-02-06 13:41:17 -0800 |
commit | 599b9655ddf95cdf6cb99970ce03c632bb2a576b (patch) | |
tree | 8a8230f39eaca8df1407c1a3d0dc65ee19f06549 /media/libstagefright/rtsp | |
parent | fba60daf77cc74a13ae3bf4b0e9925dd2ee4470c (diff) | |
download | frameworks_av-599b9655ddf95cdf6cb99970ce03c632bb2a576b.zip frameworks_av-599b9655ddf95cdf6cb99970ce03c632bb2a576b.tar.gz frameworks_av-599b9655ddf95cdf6cb99970ce03c632bb2a576b.tar.bz2 |
RTSP: Parse session level control attribute from SDP
If a=control: is present at session-level in the SDP response,
RFC2326:C.1.1 defines the URL to be used for aggregate commands.
This includes PLAY and PAUSE but not TEARDOWN.
Change-Id: Iaa1dc2271d00df39dc83477a99fda6fbeb73c5b4
Diffstat (limited to 'media/libstagefright/rtsp')
-rw-r--r-- | media/libstagefright/rtsp/MyHandler.h | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h index 4e5e2fa..2dde422 100644 --- a/media/libstagefright/rtsp/MyHandler.h +++ b/media/libstagefright/rtsp/MyHandler.h @@ -186,6 +186,27 @@ struct MyHandler : public AHandler { mConn->connect(mOriginalSessionURL.c_str(), reply); } + AString getControlURL(sp<ASessionDescription> desc) { + AString sessionLevelControlURL; + if (mSessionDesc->findAttribute( + 0, + "a=control", + &sessionLevelControlURL)) { + if (sessionLevelControlURL.compare("*") == 0) { + return mBaseURL; + } else { + AString controlURL; + CHECK(MakeURL( + mBaseURL.c_str(), + sessionLevelControlURL.c_str(), + &controlURL)); + return controlURL; + } + } else { + return mSessionURL; + } + } + void disconnect() { (new AMessage('abor', id()))->post(); } @@ -526,6 +547,8 @@ struct MyHandler : public AHandler { mBaseURL = tmp; } + mControlURL = getControlURL(mSessionDesc); + if (mSessionDesc->countTracks() < 2) { // There's no actual tracks in this session. // The first "track" is merely session meta @@ -570,6 +593,8 @@ struct MyHandler : public AHandler { mSeekable = !isLiveStream(mSessionDesc); + mControlURL = getControlURL(mSessionDesc); + if (mSessionDesc->countTracks() < 2) { // There's no actual tracks in this session. // The first "track" is merely session meta @@ -708,7 +733,7 @@ struct MyHandler : public AHandler { postKeepAlive(); AString request = "PLAY "; - request.append(mSessionURL); + request.append(mControlURL); request.append(" RTSP/1.0\r\n"); request.append("Session: "); @@ -996,7 +1021,7 @@ struct MyHandler : public AHandler { mPausing = true; AString request = "PAUSE "; - request.append(mSessionURL); + request.append(mControlURL); request.append(" RTSP/1.0\r\n"); request.append("Session: "); @@ -1032,7 +1057,7 @@ struct MyHandler : public AHandler { break; } AString request = "PLAY "; - request.append(mSessionURL); + request.append(mControlURL); request.append(" RTSP/1.0\r\n"); request.append("Session: "); @@ -1110,7 +1135,7 @@ struct MyHandler : public AHandler { break; } AString request = "PAUSE "; - request.append(mSessionURL); + request.append(mControlURL); request.append(" RTSP/1.0\r\n"); request.append("Session: "); @@ -1142,7 +1167,7 @@ struct MyHandler : public AHandler { CHECK(msg->findInt64("time", &timeUs)); AString request = "PLAY "; - request.append(mSessionURL); + request.append(mControlURL); request.append(" RTSP/1.0\r\n"); request.append("Session: "); @@ -1424,6 +1449,7 @@ private: AString mSessionURL; AString mSessionHost; AString mBaseURL; + AString mControlURL; AString mSessionID; bool mSetupTracksSuccessful; bool mSeekPending; |