Loading media/libstagefright/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ LOCAL_SRC_FILES:= \ WVMExtractor.cpp \ XINGSeeker.cpp \ avc_utils.cpp \ string.cpp LOCAL_C_INCLUDES:= \ $(JNI_H_INCLUDE) \ Loading media/libstagefright/HTTPStream.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ namespace android { // static const char *HTTPStream::kStatusKey = ":status:"; const char *HTTPStream::kStatusKey = ":status:"; // MUST be lowercase. HTTPStream::HTTPStream() : mState(READY), Loading Loading @@ -220,7 +220,7 @@ status_t HTTPStream::receive_header(int *http_status) { return err; } mHeaders.add(string(kStatusKey), string(line)); mHeaders.add(AString(kStatusKey), AString(line)); char *spacePos = strchr(line, ' '); if (spacePos == NULL) { Loading Loading @@ -264,7 +264,10 @@ status_t HTTPStream::receive_header(int *http_status) { char *colonPos = strchr(line, ':'); if (colonPos == NULL) { mHeaders.add(string(line), string()); AString key = line; key.tolower(); mHeaders.add(key, AString()); } else { char *end_of_key = colonPos; while (end_of_key > line && isspace(end_of_key[-1])) { Loading @@ -278,7 +281,10 @@ status_t HTTPStream::receive_header(int *http_status) { *end_of_key = '\0'; mHeaders.add(string(line), string(start_of_value)); AString key = line; key.tolower(); mHeaders.add(key, AString(start_of_value)); } } Loading Loading @@ -314,8 +320,11 @@ ssize_t HTTPStream::receive(void *data, size_t size) { return (ssize_t)total; } bool HTTPStream::find_header_value(const string &key, string *value) const { ssize_t index = mHeaders.indexOfKey(key); bool HTTPStream::find_header_value(const AString &key, AString *value) const { AString key_lower = key; key_lower.tolower(); ssize_t index = mHeaders.indexOfKey(key_lower); if (index < 0) { value->clear(); return false; Loading media/libstagefright/NuHTTPDataSource.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ status_t NuHTTPDataSource::connect( } if (IsRedirectStatusCode(httpStatus)) { string value; AString value; CHECK(mHTTP.find_header_value("Location", &value)); mState = DISCONNECTED; Loading @@ -198,9 +198,8 @@ status_t NuHTTPDataSource::connect( mHasChunkedTransferEncoding = false; { string value; if (mHTTP.find_header_value("Transfer-Encoding", &value) || mHTTP.find_header_value("Transfer-encoding", &value)) { AString value; if (mHTTP.find_header_value("Transfer-Encoding", &value)) { // We don't currently support any transfer encodings but // chunked. Loading @@ -222,9 +221,9 @@ status_t NuHTTPDataSource::connect( applyTimeoutResponse(); if (offset == 0) { string value; AString value; unsigned long x; if (mHTTP.find_header_value(string("Content-Length"), &value) if (mHTTP.find_header_value(AString("Content-Length"), &value) && ParseSingleUnsignedLong(value.c_str(), &x)) { mContentLength = (off64_t)x; mContentLengthValid = true; Loading @@ -239,9 +238,9 @@ status_t NuHTTPDataSource::connect( return ERROR_UNSUPPORTED; } string value; AString value; unsigned long x; if (mHTTP.find_header_value(string("Content-Range"), &value)) { if (mHTTP.find_header_value(AString("Content-Range"), &value)) { const char *slashPos = strchr(value.c_str(), '/'); if (slashPos != NULL && ParseSingleUnsignedLong(slashPos + 1, &x)) { Loading Loading @@ -439,7 +438,7 @@ void NuHTTPDataSource::MakeFullHeaders( } void NuHTTPDataSource::applyTimeoutResponse() { string timeout; AString timeout; if (mHTTP.find_header_value("X-SocketTimeout", &timeout)) { const char *s = timeout.c_str(); char *end; Loading media/libstagefright/ShoutcastSource.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ * limitations under the License. */ #include "include/stagefright_string.h" #include "include/HTTPStream.h" #include <stdlib.h> Loading @@ -34,7 +33,7 @@ ShoutcastSource::ShoutcastSource(HTTPStream *http) mBytesUntilMetaData(0), mGroup(NULL), mStarted(false) { string metaint; AString metaint; if (mHttp->find_header_value("icy-metaint", &metaint)) { char *end; const char *start = metaint.c_str(); Loading media/libstagefright/include/HTTPStream.h +3 −4 Original line number Diff line number Diff line Loading @@ -18,10 +18,9 @@ #define HTTP_STREAM_H_ #include "stagefright_string.h" #include <sys/types.h> #include <media/stagefright/foundation/AString.h> #include <media/stagefright/MediaErrors.h> #include <utils/KeyedVector.h> #include <utils/threads.h> Loading Loading @@ -50,7 +49,7 @@ public: static const char *kStatusKey; bool find_header_value( const string &key, string *value) const; const AString &key, AString *value) const; // Pass a negative value to disable the timeout. void setReceiveTimeout(int seconds); Loading @@ -70,7 +69,7 @@ private: Mutex mLock; int mSocket; KeyedVector<string, string> mHeaders; KeyedVector<AString, AString> mHeaders; HTTPStream(const HTTPStream &); HTTPStream &operator=(const HTTPStream &); Loading Loading
media/libstagefright/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ LOCAL_SRC_FILES:= \ WVMExtractor.cpp \ XINGSeeker.cpp \ avc_utils.cpp \ string.cpp LOCAL_C_INCLUDES:= \ $(JNI_H_INCLUDE) \ Loading
media/libstagefright/HTTPStream.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ namespace android { // static const char *HTTPStream::kStatusKey = ":status:"; const char *HTTPStream::kStatusKey = ":status:"; // MUST be lowercase. HTTPStream::HTTPStream() : mState(READY), Loading Loading @@ -220,7 +220,7 @@ status_t HTTPStream::receive_header(int *http_status) { return err; } mHeaders.add(string(kStatusKey), string(line)); mHeaders.add(AString(kStatusKey), AString(line)); char *spacePos = strchr(line, ' '); if (spacePos == NULL) { Loading Loading @@ -264,7 +264,10 @@ status_t HTTPStream::receive_header(int *http_status) { char *colonPos = strchr(line, ':'); if (colonPos == NULL) { mHeaders.add(string(line), string()); AString key = line; key.tolower(); mHeaders.add(key, AString()); } else { char *end_of_key = colonPos; while (end_of_key > line && isspace(end_of_key[-1])) { Loading @@ -278,7 +281,10 @@ status_t HTTPStream::receive_header(int *http_status) { *end_of_key = '\0'; mHeaders.add(string(line), string(start_of_value)); AString key = line; key.tolower(); mHeaders.add(key, AString(start_of_value)); } } Loading Loading @@ -314,8 +320,11 @@ ssize_t HTTPStream::receive(void *data, size_t size) { return (ssize_t)total; } bool HTTPStream::find_header_value(const string &key, string *value) const { ssize_t index = mHeaders.indexOfKey(key); bool HTTPStream::find_header_value(const AString &key, AString *value) const { AString key_lower = key; key_lower.tolower(); ssize_t index = mHeaders.indexOfKey(key_lower); if (index < 0) { value->clear(); return false; Loading
media/libstagefright/NuHTTPDataSource.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ status_t NuHTTPDataSource::connect( } if (IsRedirectStatusCode(httpStatus)) { string value; AString value; CHECK(mHTTP.find_header_value("Location", &value)); mState = DISCONNECTED; Loading @@ -198,9 +198,8 @@ status_t NuHTTPDataSource::connect( mHasChunkedTransferEncoding = false; { string value; if (mHTTP.find_header_value("Transfer-Encoding", &value) || mHTTP.find_header_value("Transfer-encoding", &value)) { AString value; if (mHTTP.find_header_value("Transfer-Encoding", &value)) { // We don't currently support any transfer encodings but // chunked. Loading @@ -222,9 +221,9 @@ status_t NuHTTPDataSource::connect( applyTimeoutResponse(); if (offset == 0) { string value; AString value; unsigned long x; if (mHTTP.find_header_value(string("Content-Length"), &value) if (mHTTP.find_header_value(AString("Content-Length"), &value) && ParseSingleUnsignedLong(value.c_str(), &x)) { mContentLength = (off64_t)x; mContentLengthValid = true; Loading @@ -239,9 +238,9 @@ status_t NuHTTPDataSource::connect( return ERROR_UNSUPPORTED; } string value; AString value; unsigned long x; if (mHTTP.find_header_value(string("Content-Range"), &value)) { if (mHTTP.find_header_value(AString("Content-Range"), &value)) { const char *slashPos = strchr(value.c_str(), '/'); if (slashPos != NULL && ParseSingleUnsignedLong(slashPos + 1, &x)) { Loading Loading @@ -439,7 +438,7 @@ void NuHTTPDataSource::MakeFullHeaders( } void NuHTTPDataSource::applyTimeoutResponse() { string timeout; AString timeout; if (mHTTP.find_header_value("X-SocketTimeout", &timeout)) { const char *s = timeout.c_str(); char *end; Loading
media/libstagefright/ShoutcastSource.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ * limitations under the License. */ #include "include/stagefright_string.h" #include "include/HTTPStream.h" #include <stdlib.h> Loading @@ -34,7 +33,7 @@ ShoutcastSource::ShoutcastSource(HTTPStream *http) mBytesUntilMetaData(0), mGroup(NULL), mStarted(false) { string metaint; AString metaint; if (mHttp->find_header_value("icy-metaint", &metaint)) { char *end; const char *start = metaint.c_str(); Loading
media/libstagefright/include/HTTPStream.h +3 −4 Original line number Diff line number Diff line Loading @@ -18,10 +18,9 @@ #define HTTP_STREAM_H_ #include "stagefright_string.h" #include <sys/types.h> #include <media/stagefright/foundation/AString.h> #include <media/stagefright/MediaErrors.h> #include <utils/KeyedVector.h> #include <utils/threads.h> Loading Loading @@ -50,7 +49,7 @@ public: static const char *kStatusKey; bool find_header_value( const string &key, string *value) const; const AString &key, AString *value) const; // Pass a negative value to disable the timeout. void setReceiveTimeout(int seconds); Loading @@ -70,7 +69,7 @@ private: Mutex mLock; int mSocket; KeyedVector<string, string> mHeaders; KeyedVector<AString, AString> mHeaders; HTTPStream(const HTTPStream &); HTTPStream &operator=(const HTTPStream &); Loading