Bug 1536766 - Send a black dummy frame out when a video track that contained no frames ends. r=jya
☠☠ backed out by 41f1dcbe9caa ☠ ☠
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 18 Apr 2019 15:23:28 +0000
changeset 470098 000260ba28de8b30791c72a6871d5879b92fe59d
parent 470097 6386ed1b7d741daadea35af8389f58f8df0376b3
child 470099 36f99fa3c95664b13b4839a0900217debdb74539
push id112843
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:50:22 +0000
treeherdermozilla-inbound@c06f27cbfe40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1536766
milestone68.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 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
dom/media/mediasink/DecodedStream.cpp
--- a/dom/media/mediasink/DecodedStream.cpp
+++ b/dom/media/mediasink/DecodedStream.cpp
@@ -738,16 +738,28 @@ void DecodedStream::SendVideo(bool aIsSa
   }
 
   if (output.GetDuration() > 0) {
     mData->mStreamVideoWritten +=
         sourceStream->AppendToTrack(videoTrackId, &output);
   }
 
   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.
       auto deviation =
           FromMicroseconds(sourceStream->StreamTimeToMicroseconds(1));
       WriteVideoToMediaStream(
           sourceStream, mData->mLastVideoImage, mData->mNextVideoTime,
           mData->mNextVideoTime + deviation, mData->mLastVideoImageDisplaySize,