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
--- 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.");