summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/DataSource.cpp
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 /media/libstagefright/DataSource.cpp
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 'media/libstagefright/DataSource.cpp')
-rw-r--r--media/libstagefright/DataSource.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp
index 8468a07..284e3bc 100644
--- a/media/libstagefright/DataSource.cpp
+++ b/media/libstagefright/DataSource.cpp
@@ -101,8 +101,11 @@ sp<DataSource> DataSource::CreateFromURI(
if (!strncasecmp("file://", uri, 7)) {
source = new FileSource(uri + 7);
} else if (!strncasecmp("http://", uri, 7)) {
- source = new HTTPDataSource(uri, headers);
- source = new CachingDataSource(source, 32 * 1024, 20);
+ sp<HTTPDataSource> httpSource = new HTTPDataSource(uri, headers);
+ if (httpSource->connect() != OK) {
+ return NULL;
+ }
+ source = new CachingDataSource(httpSource, 32 * 1024, 20);
} else {
// Assume it's a filename.
source = new FileSource(uri);