From 4fd9a5752f84763715aefbc4c2fd617dfb9fc989 Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Thu, 18 Apr 2019 15:23:28 +0000 Subject: [PATCH] Bug 1536766 - Send a black dummy frame out when a video track that contained no frames ends. r=jya This is similar to what VideoSink does, and is required for us to end playback on HAVE_CURRENT_DATA (a frame for currentTime must be available). Differential Revision: https://phabricator.services.mozilla.com/D27261 --HG-- extra : moz-landing-system : lando --- dom/media/mediasink/DecodedStream.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/media/mediasink/DecodedStream.cpp b/dom/media/mediasink/DecodedStream.cpp index 8d978e98508e..bc6c150670ed 100644 --- a/dom/media/mediasink/DecodedStream.cpp +++ b/dom/media/mediasink/DecodedStream.cpp @@ -743,6 +743,18 @@ void DecodedStream::SendVideo(bool aIsSameOrigin, } if (mVideoQueue.IsFinished() && !mData->mHaveSentFinishVideo) { + if (!mData->mLastVideoImage) { + // We have video, but the video queue finished before we received any + // frame. We insert a black frame to progress any consuming + // HTMLMediaElement. This mirrors the behavior of VideoSink. + + // Force a frame - can be null + compensateEOS = true; + // Force frame to be black + aIsSameOrigin = false; + // Override the frame's size (will be 0x0 otherwise) + mData->mLastVideoImageDisplaySize = mInfo.mVideo.mDisplay; + } if (compensateEOS) { VideoSegment endSegment; // Calculate the deviation clock time from DecodedStream.