From edbb4d8f398dfbce7b766d4bd207685dab582847 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 12 Mar 2010 08:59:22 -0800 Subject: HTTPStream and HTTPDataSource now support cancellation of the connection process, AwesomePlayer takes advantage of this in cases where ::reset() or ::suspend() is called while in the preparation phase to bail out early. Also fixes in issue where the audio codec was not properly stopped if no audio player object ever took ownership. Change-Id: I6d73defe6d276693853a469db267bb2668d07af5 related-to-bugs: 2475845,2414536 --- include/media/stagefright/HTTPDataSource.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/media/stagefright/HTTPDataSource.h b/include/media/stagefright/HTTPDataSource.h index 23522bd..b6176eb 100644 --- a/include/media/stagefright/HTTPDataSource.h +++ b/include/media/stagefright/HTTPDataSource.h @@ -20,6 +20,7 @@ #include #include +#include namespace android { @@ -35,6 +36,9 @@ public: const char *uri, const KeyedVector *headers = NULL); + status_t connect(); + void disconnect(); + virtual status_t initCheck() const; virtual ssize_t readAt(off_t offset, void *data, size_t size); @@ -53,8 +57,21 @@ private: kBufferSize = 32 * 1024 }; + enum State { + DISCONNECTED, + CONNECTING, + CONNECTED + }; + + State mState; + mutable Mutex mStateLock; + String8 mHeaders; + String8 mStartingHost; + String8 mStartingPath; + int mStartingPort; + HTTPStream *mHttp; char *mHost; int mPort; @@ -67,11 +84,7 @@ private: bool mContentLengthValid; unsigned long long mContentLength; - status_t mInitCheck; - - void init( - const char *_host, int port, const char *_path, - const KeyedVector *headers); + void init(const KeyedVector *headers); ssize_t sendRangeRequest(size_t offset); void initHeaders(const KeyedVector *overrides); -- cgit v1.1