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
commitedbb4d8f398dfbce7b766d4bd207685dab582847 (patch)
tree97424243885172334a9905a99eb00fce3b90016e /include
parent84eb8d2a7de0a2cec02516b9fb2a61fde536b59c (diff)
downloadframeworks_base-edbb4d8f398dfbce7b766d4bd207685dab582847.zip
frameworks_base-edbb4d8f398dfbce7b766d4bd207685dab582847.tar.gz
frameworks_base-edbb4d8f398dfbce7b766d4bd207685dab582847.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);