diff options
author | Andreas Huber <andih@google.com> | 2011-12-12 08:32:28 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-12 08:32:28 -0800 |
commit | 6af1e76b61d04ed524b570f92091680a851207df (patch) | |
tree | ebd691ae57ff1efff4011a367e29e520ac2cb8c3 /media/libstagefright/rtsp/ARTSPConnection.cpp | |
parent | d2927a79dc933a134e022281a4679a65e340dc3a (diff) | |
parent | 4aae77cbe1bf4369910314a55c2bc2349af10d3c (diff) | |
download | frameworks_av-6af1e76b61d04ed524b570f92091680a851207df.zip frameworks_av-6af1e76b61d04ed524b570f92091680a851207df.tar.gz frameworks_av-6af1e76b61d04ed524b570f92091680a851207df.tar.bz2 |
Merge "Support for parsing of "folded" RTSP header values and some tweaks to the AMR assembler"
Diffstat (limited to 'media/libstagefright/rtsp/ARTSPConnection.cpp')
-rw-r--r-- | media/libstagefright/rtsp/ARTSPConnection.cpp | 24 |
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; |