Bug 952006 - [RTSP][Video] System crash while RTSP reconnecting. r=sworkman, a=1.3+
authorEthan Tseng <ettseng@mozilla.com>
Thu, 19 Dec 2013 16:51:23 +0800
changeset 175616 35219c188d424999d50b81a055384c9bcd564f45
parent 175615 00745445ecaafd6bafe9863da98ee442ba5d4af2
child 175617 6154327ecec00eb44ae574e7c552981cbce7883c
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman, 1
bugs952006
milestone28.0a2
Bug 952006 - [RTSP][Video] System crash while RTSP reconnecting. 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
@@ -453,21 +453,26 @@ void RTSPSource::onMessageReceived(const
 
         default:
             TRESPASS();
     }
 }
 
 void RTSPSource::onConnected(bool isSeekable)
 {
-    CHECK(mAudioTrack == NULL);
-    CHECK(mVideoTrack == NULL);
     CHECK(mHandler != NULL);
     CHECK(mListener != NULL);
 
+    // Clean up audio and video tracks.
+    // In the case of RTSP reconnect, audio/video tracks might be created by
+    // previous onConnected event.
+    mAudioTrack = NULL;
+    mVideoTrack = NULL;
+    mTracks.clear();
+
     size_t numTracks = mHandler->countTracks();
     for (size_t i = 0; i < numTracks; ++i) {
         int32_t timeScale;
         sp<MetaData> format = mHandler->getTrackFormat(i, &timeScale);
         CHECK(format != NULL);
 
         const char *mime;
         CHECK(format->findCString(kKeyMIMEType, &mime));