OSDN Git Service

wifi-display: fixes for PAUSE/PLAY state
authorChong Zhang <chz@google.com>
Thu, 30 May 2013 16:46:20 +0000 (09:46 -0700)
committerChong Zhang <chz@google.com>
Thu, 30 May 2013 17:16:05 +0000 (10:16 -0700)
PAUSE could be initiated by either source (via trigger method)
or sink, in latter case we have to allow PAUSE from PLAYING state.
Similarly PLAY should be allowed from PAUSED state.

Bug: 8922515

Change-Id: I475534aa4ffa6dc6844f59c5868d8f88291019ae

media/libstagefright/wifi-display/source/WifiDisplaySource.cpp

index 0b714f0..dee95eb 100644 (file)
@@ -1369,7 +1369,9 @@ status_t WifiDisplaySource::onPlayRequest(
         return ERROR_MALFORMED;
     }
 
-    if (mState != AWAITING_CLIENT_PLAY) {
+    if (mState != AWAITING_CLIENT_PLAY
+     && mState != PAUSED_TO_PLAYING
+     && mState != PAUSED) {
         ALOGW("Received PLAY request but we're in state %d", mState);
 
         sendErrorResponse(
@@ -1396,7 +1398,7 @@ status_t WifiDisplaySource::onPlayRequest(
         return err;
     }
 
-    if (mState == PAUSED_TO_PLAYING) {
+    if (mState == PAUSED_TO_PLAYING || mPlaybackSessionEstablished) {
         mState = PLAYING;
         return OK;
     }
@@ -1430,7 +1432,7 @@ status_t WifiDisplaySource::onPauseRequest(
 
     ALOGI("Received PAUSE request.");
 
-    if (mState != PLAYING_TO_PAUSED) {
+    if (mState != PLAYING_TO_PAUSED && mState != PLAYING) {
         return INVALID_OPERATION;
     }