summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/rtsp/ASessionDescription.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-20 15:00:34 -0700
committerAndreas Huber <andih@google.com>2010-10-20 15:01:01 -0700
commit4579b7d49f6dd4f37e6043e59debfd72d69b8e7b (patch)
tree4a3611bf36ef0ab70971df7a0c8314fb97d7d582 /media/libstagefright/rtsp/ASessionDescription.cpp
parent6a9da9fc558263548ebfbae2cbf177eb7454a41b (diff)
downloadframeworks_av-4579b7d49f6dd4f37e6043e59debfd72d69b8e7b.zip
frameworks_av-4579b7d49f6dd4f37e6043e59debfd72d69b8e7b.tar.gz
frameworks_av-4579b7d49f6dd4f37e6043e59debfd72d69b8e7b.tar.bz2
Support for BASIC and DIGEST authentication schemes in RTSP. Support for malformed packet descriptions that end lines in LF only, instead of CRLF.
Change-Id: I57eaefdc4b300a8f56bbe5cf3a34c424e8efe63a related-to-bug: 3084183
Diffstat (limited to 'media/libstagefright/rtsp/ASessionDescription.cpp')
-rw-r--r--media/libstagefright/rtsp/ASessionDescription.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp
index 612caff..880aa85 100644
--- a/media/libstagefright/rtsp/ASessionDescription.cpp
+++ b/media/libstagefright/rtsp/ASessionDescription.cpp
@@ -57,12 +57,20 @@ bool ASessionDescription::parse(const void *data, size_t size) {
size_t i = 0;
for (;;) {
- ssize_t eolPos = desc.find("\r\n", i);
+ ssize_t eolPos = desc.find("\n", i);
+
if (eolPos < 0) {
break;
}
- AString line(desc, i, eolPos - i);
+ AString line;
+ if ((size_t)eolPos > i && desc.c_str()[eolPos - 1] == '\r') {
+ // We accept both '\n' and '\r\n' line endings, if it's
+ // the latter, strip the '\r' as well.
+ line.setTo(desc, i, eolPos - i - 1);
+ } else {
+ line.setTo(desc, i, eolPos - i);
+ }
if (line.size() < 2 || line.c_str()[1] != '=') {
return false;
@@ -141,7 +149,7 @@ bool ASessionDescription::parse(const void *data, size_t size) {
}
}
- i = eolPos + 2;
+ i = eolPos + 1;
}
return true;
@@ -245,7 +253,7 @@ bool ASessionDescription::getDurationUs(int64_t *durationUs) const {
return false;
}
- if (value == "npt=now-") {
+ if (value == "npt=now-" || value == "npt=0-") {
return false;
}