summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media/libstagefright/AwesomePlayer.cpp11
-rw-r--r--media/libstagefright/include/AwesomePlayer.h1
-rw-r--r--media/libstagefright/rtsp/ARTSPController.cpp9
3 files changed, 19 insertions, 2 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index e36884889de7..cb080239322b 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -399,6 +399,9 @@ void AwesomePlayer::reset_l() {
if (mConnectingDataSource != NULL) {
LOGI("interrupting the connection process");
mConnectingDataSource->disconnect();
+ } else if (mConnectingRTSPController != NULL) {
+ LOGI("interrupting the connection process");
+ mConnectingRTSPController->disconnect();
}
if (mFlags & PREPARING_CONNECTED) {
@@ -409,7 +412,7 @@ void AwesomePlayer::reset_l() {
}
if (mFlags & PREPARING) {
- LOGI("waiting until preparation is completes.");
+ LOGI("waiting until preparation is completed.");
}
while (mFlags & PREPARING) {
@@ -1633,7 +1636,13 @@ status_t AwesomePlayer::finishSetDataSource_l() {
mLooper->start();
}
mRTSPController = new ARTSPController(mLooper);
+ mConnectingRTSPController = mRTSPController;
+
+ mLock.unlock();
status_t err = mRTSPController->connect(mUri.string());
+ mLock.lock();
+
+ mConnectingRTSPController.clear();
LOGI("ARTSPController::connect returned %d", err);
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 797e5ca66d40..98b8c05d8e15 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -205,6 +205,7 @@ private:
sp<ALooper> mLooper;
sp<ARTSPController> mRTSPController;
+ sp<ARTSPController> mConnectingRTSPController;
sp<LiveSession> mLiveSession;
diff --git a/media/libstagefright/rtsp/ARTSPController.cpp b/media/libstagefright/rtsp/ARTSPController.cpp
index a7563ff93b3d..1328d2ec595c 100644
--- a/media/libstagefright/rtsp/ARTSPController.cpp
+++ b/media/libstagefright/rtsp/ARTSPController.cpp
@@ -69,7 +69,14 @@ status_t ARTSPController::connect(const char *url) {
void ARTSPController::disconnect() {
Mutex::Autolock autoLock(mLock);
- if (mState != CONNECTED) {
+ if (mState == CONNECTING) {
+ mState = DISCONNECTED;
+ mConnectionResult = ERROR_IO;
+ mCondition.broadcast();
+
+ mHandler.clear();
+ return;
+ } else if (mState != CONNECTED) {
return;
}