Bug 947101 - Rtsp: Backward seek fail. r=sworkman, a=1.3+
authorVincent Chang <vchang@mozilla.com>
Fri, 06 Dec 2013 15:29:07 +0800
changeset 174254 b0b118d4ec72c1c3a00e4920d0bd989a8ff567f7
parent 174253 6e64771384ca4ee81f2954bb2795a468d929b520
child 174255 5d3986855f3feae34f71e44c72a10825b1261918
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman, 1
bugs947101
milestone28.0a2
Bug 947101 - Rtsp: Backward seek fail. r=sworkman, a=1.3+
netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
--- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
+++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
@@ -215,18 +215,19 @@ void RTSPSource::performPlay(int64_t pla
 void RTSPSource::performPause() {
     if (mState != PLAYING) {
         return;
     }
     LOGI("performPause :");
     for (size_t i = 0; i < mTracks.size(); ++i) {
       TrackInfo *info = &mTracks.editItemAt(i);
       info->mLatestPausedUnit = 0;
-      mLatestPausedUnit = 0;
     }
+    mLatestPausedUnit = 0;
+
     mState = PAUSING;
     mHandler->pause();
 }
 
 void RTSPSource::performResume() {
 // TODO, Bug 895753.
 }
 
@@ -237,18 +238,18 @@ void RTSPSource::performSuspend() {
 void RTSPSource::performSeek(int64_t seekTimeUs) {
     if (mState != PLAYING && mState != PAUSING) {
         return;
     }
     LOGI("performSeek: %llu", seekTimeUs);
     for (size_t i = 0; i < mTracks.size(); ++i) {
       TrackInfo *info = &mTracks.editItemAt(i);
       info->mLatestPausedUnit = 0;
-      mLatestPausedUnit = 0;
     }
+    mLatestPausedUnit = 0;
 
     mState = SEEKING;
     mHandler->seek(seekTimeUs);
 }
 
 bool RTSPSource::isSeekable() {
     return true;
 }
@@ -305,16 +306,24 @@ void RTSPSource::onMessageReceived(const
 
         case RtspConnectionHandler::kWhatDisconnected:
             onDisconnected(msg);
             break;
 
         case RtspConnectionHandler::kWhatSeekDone:
         {
             mState = PLAYING;
+            // Even if we have reset mLatestPausedUnit in performSeek(),
+            // it's still possible that kWhatPausedDone event may arrive
+            // because of previous performPause() command.
+            for (size_t i = 0; i < mTracks.size(); ++i) {
+                TrackInfo *info = &mTracks.editItemAt(i);
+                info->mLatestPausedUnit = 0;
+            }
+            mLatestPausedUnit = 0;
             break;
         }
 
         case RtspConnectionHandler::kWhatPausedDone:
         {
             for (size_t i = 0; i < mTracks.size(); ++i) {
                 TrackInfo *info = &mTracks.editItemAt(i);
                 info->mLatestPausedUnit = info->mLatestReceivedUnit;