summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/rtsp/ARTSPConnection.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-12-09 15:09:56 -0800
committerAndreas Huber <andih@google.com>2011-12-09 15:09:56 -0800
commit4aae77cbe1bf4369910314a55c2bc2349af10d3c (patch)
treebefe62758daa28bdef02b1e687a38f545c862eaf /media/libstagefright/rtsp/ARTSPConnection.cpp
parenteebeceec684a36222b4559e3157b0db04c0a67ed (diff)
downloadframeworks_av-4aae77cbe1bf4369910314a55c2bc2349af10d3c.zip
frameworks_av-4aae77cbe1bf4369910314a55c2bc2349af10d3c.tar.gz
frameworks_av-4aae77cbe1bf4369910314a55c2bc2349af10d3c.tar.bz2
Support for parsing of "folded" RTSP header values and some tweaks to the AMR assembler
contributed by Samsung (untested). Change-Id: I182561fe0a1a564126bdbb317e96aa52bf525726
Diffstat (limited to 'media/libstagefright/rtsp/ARTSPConnection.cpp')
-rw-r--r--media/libstagefright/rtsp/ARTSPConnection.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/media/libstagefright/rtsp/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp
index 0fbbb9e..d8107bc 100644
--- a/media/libstagefright/rtsp/ARTSPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTSPConnection.cpp
@@ -659,6 +659,7 @@ bool ARTSPConnection::receiveRTSPReponse() {
}
AString line;
+ ssize_t lastDictIndex = -1;
for (;;) {
if (!receiveLine(&line)) {
break;
@@ -668,7 +669,21 @@ bool ARTSPConnection::receiveRTSPReponse() {
break;
}
- ALOGV("line: %s", line.c_str());
+ ALOGV("line: '%s'", line.c_str());
+
+ if (line.c_str()[0] == ' ' || line.c_str()[0] == '\t') {
+ // Support for folded header values.
+
+ if (lastDictIndex < 0) {
+ // First line cannot be a continuation of the previous one.
+ return false;
+ }
+
+ AString &value = response->mHeaders.editValueAt(lastDictIndex);
+ value.append(line);
+
+ continue;
+ }
ssize_t colonPos = line.find(":");
if (colonPos < 0) {
@@ -681,9 +696,12 @@ bool ARTSPConnection::receiveRTSPReponse() {
key.tolower();
line.erase(0, colonPos + 1);
- line.trim();
- response->mHeaders.add(key, line);
+ lastDictIndex = response->mHeaders.add(key, line);
+ }
+
+ for (size_t i = 0; i < response->mHeaders.size(); ++i) {
+ response->mHeaders.editValueAt(i).trim();
}
unsigned long contentLength = 0;