summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-03-12 08:59:22 -0800
committerAndreas Huber <andih@google.com>2010-03-12 09:05:10 -0800
commite94bd14078d327ef2f800e69907efce641a13272 (patch)
treeb0316c579a69bc32d23c5881fe27003ec4f6e160 /include
parent6fc13ab8d00819b7420d1b0a500896264e820409 (diff)
downloadframeworks_av-e94bd14078d327ef2f800e69907efce641a13272.zip
frameworks_av-e94bd14078d327ef2f800e69907efce641a13272.tar.gz
frameworks_av-e94bd14078d327ef2f800e69907efce641a13272.tar.bz2
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
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);