Bug 1080464 - [RTSP] Live stream frames are not rendered. r=ettseng r=bechen
authorJonathan Hao <jhao@mozilla.com>
Mon, 13 Oct 2014 11:30:26 +0800
changeset 211309 2764dc71106f45cf6178c8040a53773e57bee2c6
parent 211308 eb9c0b46ccf5ce6ed7cdf8def6fec144a5c01b5a
child 211310 ec008b16c0d4eccc0d08804903c79c0ab3c65282
push id50691
push userkwierso@gmail.com
push dateTue, 21 Oct 2014 02:08:21 +0000
treeherdermozilla-inbound@0808729b24e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersettseng, bechen
bugs1080464
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1080464 - [RTSP] Live stream frames are not rendered. r=ettseng r=bechen
content/media/MediaDecoderStateMachine.cpp
netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2702,17 +2702,18 @@ void MediaDecoderStateMachine::AdvanceFr
   if (currentFrame) {
     // Decode one frame and display it.
     TimeStamp presTime = mPlayStartTime - UsecsToDuration(mPlayDuration) +
                           UsecsToDuration(currentFrame->mTime - mStartTime);
     NS_ASSERTION(currentFrame->mTime >= mStartTime, "Should have positive frame time");
     // Filter out invalid frames by checking the frame time. FrameTime could be
     // zero if it's a initial frame.
     int64_t frameTime = currentFrame->mTime - mStartTime;
-    if (frameTime > 0  || (frameTime == 0 && mPlayDuration == 0)) {
+    if (frameTime > 0  || (frameTime == 0 && mPlayDuration == 0) ||
+        mScheduler->IsRealTime()) {
       ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
       // If we have video, we want to increment the clock in steps of the frame
       // duration.
       RenderVideoFrame(currentFrame, presTime);
     }
     // If we're no longer playing after dropping and reacquiring the lock,
     // playback must've been stopped on the decode thread (by a seek, for
     // example).  In that case, the current frame is probably out of date.
--- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
+++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
@@ -226,19 +226,20 @@ void RTSPSource::performPlay(int64_t pla
     }
     // Use the latest received frame time if we were paused.
     if (mState == PAUSED) {
         playTimeUs = mLatestPausedUnit;
     }
 
     int64_t duration = 0;
     getDuration(&duration);
-    MOZ_ASSERT(playTimeUs < duration,
+    MOZ_ASSERT(duration == 0 || playTimeUs < duration,
                "Should never receive an out of bounds play time!");
-    if (playTimeUs >= duration) {
+    if (duration > 0 && playTimeUs >= duration) {
+        // if not a live stream and play time out of bounds
         return;
     }
 
     LOGI("performPlay : duration=%lld playTimeUs=%lld", duration, playTimeUs);
     mState = PLAYING;
     mHandler->play(playTimeUs);
 }