summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-03-12 09:39:33 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-12 09:39:33 -0800
commit34ec95de2f96a5f85d5e4e0f99252b99c0aca14f (patch)
treecb9c2c5339a7c5c7bbd2759060b449b9611419f6 /include
parent45be271b5f3413c6815e18331d2ffa07d88fd3f6 (diff)
parentedbb4d8f398dfbce7b766d4bd207685dab582847 (diff)
downloadframeworks_base-34ec95de2f96a5f85d5e4e0f99252b99c0aca14f.zip
frameworks_base-34ec95de2f96a5f85d5e4e0f99252b99c0aca14f.tar.gz
frameworks_base-34ec95de2f96a5f85d5e4e0f99252b99c0aca14f.tar.bz2
Merge "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."
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/HTTPDataSource.h23
1 files changed, 18 insertions, 5 deletions
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 <media/stagefright/DataSource.h>
#include <utils/String8.h>
+#include <utils/threads.h>
namespace android {
@@ -35,6 +36,9 @@ public:
const char *uri,
const KeyedVector<String8, String8> *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<String8, String8> *headers);
+ void init(const KeyedVector<String8, String8> *headers);
ssize_t sendRangeRequest(size_t offset);
void initHeaders(const KeyedVector<String8, String8> *overrides);