Bug 1346120 part 4 - Only set ImageContainer if there are valid new images in VideoSink::RenderVideoFrames(); r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Thu, 09 Mar 2017 17:16:17 +0800
changeset 497397 36ff6ea779555f6faad37a41793567e63635b03a
parent 497396 b67db415085c8d85e3deababb5edcc852f83a914
child 497398 89a681d0ce880407e28457fcc112e9a0ca5fc4dc
push id48887
push userbmo:kaku@mozilla.com
push dateMon, 13 Mar 2017 08:42:35 +0000
reviewersjwwang
bugs1346120
milestone55.0a1
Bug 1346120 part 4 - Only set ImageContainer if there are valid new images in VideoSink::RenderVideoFrames(); r?jwwang So that the suspended video element won't be rendered any more and keeps the last decoded frame. This is the effect that UX specification defines. And actually, we don't need to set ImageContainer if there are no valid new images. MozReview-Commit-ID: B7RS3LXu8J0
dom/media/mediasink/VideoSink.cpp
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -395,17 +395,20 @@ VideoSink::RenderVideoFrames(int32_t aMa
     img->mTimeStamp = t;
     img->mImage = frame->mImage;
     img->mFrameID = frame->mFrameID;
     img->mProducerID = mProducerID;
 
     VSINK_LOG_V("playing video frame %" PRId64 " (id=%x) (vq-queued=%" PRIuSIZE ")",
                 frame->mTime, frame->mFrameID, VideoQueue().GetSize());
   }
-  mContainer->SetCurrentFrames(frames[0]->As<VideoData>()->mDisplay, images);
+
+  if (images.Length() > 0) {
+    mContainer->SetCurrentFrames(frames[0]->As<VideoData>()->mDisplay, images);
+  }
 }
 
 void
 VideoSink::UpdateRenderedVideoFrames()
 {
   AssertOwnerThread();
   MOZ_ASSERT(mAudioSink->IsPlaying(), "should be called while playing.");