summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2013-02-05 14:47:13 -0800
committerAndreas Huber <andih@google.com>2013-02-05 15:27:16 -0800
commit7f475c34ffc8e35345f2cceee2ef56a50bb5fea6 (patch)
treed27f2ad0bb24ae1d97d4cf21fb692c3f2748f8c2 /media/libmediaplayerservice/nuplayer/RTSPSource.cpp
parentb81b557d6e89cc2960b74ab343a08b5b44bff1f2 (diff)
downloadframeworks_av-7f475c34ffc8e35345f2cceee2ef56a50bb5fea6.zip
frameworks_av-7f475c34ffc8e35345f2cceee2ef56a50bb5fea6.tar.gz
frameworks_av-7f475c34ffc8e35345f2cceee2ef56a50bb5fea6.tar.bz2
RTSP now properly publishes its "seekable" flags after connection
has successfully completed and only then signals that preparation is complete. Change-Id: I1a60f718e673fe1462c69369c40eafbed6a14326
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/RTSPSource.cpp')
-rw-r--r--media/libmediaplayerservice/nuplayer/RTSPSource.cpp41
1 files changed, 31 insertions, 10 deletions
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index e4d72d9..d787647 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -96,16 +96,6 @@ void NuPlayer::RTSPSource::prepareAsync() {
mHandler->connect();
}
-
- notifyVideoSizeChanged(0, 0);
-
- notifyFlagsChanged(
- FLAG_CAN_PAUSE
- | FLAG_CAN_SEEK_BACKWARD
- | FLAG_CAN_SEEK_FORWARD
- | FLAG_CAN_SEEK);
-
- notifyPrepared();
}
void NuPlayer::RTSPSource::start() {
@@ -270,12 +260,31 @@ void NuPlayer::RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
switch (what) {
case MyHandler::kWhatConnected:
+ {
onConnected();
+
+ notifyVideoSizeChanged(0, 0);
+
+ uint32_t flags = 0;
+
+ if (mHandler->isSeekable()) {
+ flags = FLAG_CAN_PAUSE | FLAG_CAN_SEEK;
+
+ // Seeking 10secs forward or backward is a very expensive
+ // operation for rtsp, so let's not enable that.
+ // The user can always use the seek bar.
+ }
+
+ notifyFlagsChanged(flags);
+ notifyPrepared();
break;
+ }
case MyHandler::kWhatDisconnected:
+ {
onDisconnected(msg);
break;
+ }
case MyHandler::kWhatSeekDone:
{
@@ -520,6 +529,12 @@ void NuPlayer::RTSPSource::onSDPLoaded(const sp<AMessage> &msg) {
}
if (err != OK) {
+ if (mState == CONNECTING) {
+ // We're still in the preparation phase, signal that it
+ // failed.
+ notifyPrepared(err);
+ }
+
mState = DISCONNECTED;
mFinalResult = err;
@@ -537,6 +552,12 @@ void NuPlayer::RTSPSource::onDisconnected(const sp<AMessage> &msg) {
mLooper->unregisterHandler(mHandler->id());
mHandler.clear();
+ if (mState == CONNECTING) {
+ // We're still in the preparation phase, signal that it
+ // failed.
+ notifyPrepared(err);
+ }
+
mState = DISCONNECTED;
mFinalResult = err;