Bug 1536766 - Don't ignore null frames in MediaStreamGraph. r=padenot
☠☠ backed out by 41f1dcbe9caa ☠ ☠
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 18 Apr 2019 15:23:46 +0000
changeset 528915 87616997f16017b85f463691262261db6490c30b
parent 528914 36f99fa3c95664b13b4839a0900217debdb74539
child 528916 f9d1f1bfe2b126dc1588e56724b860674519805a
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
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 - Don't ignore null frames in MediaStreamGraph. r=padenot Null frames could still be valid. It's how DecodedStream signals a pause. They could also be valid and have an intrinsic size and the force-black flag set. Differential Revision: https://phabricator.services.mozilla.com/D27263
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -2781,54 +2781,49 @@ void SourceMediaStream::AddDirectTrackLi
   LOG(LogLevel::Debug,
       ("%p: Added direct track listener %p", GraphImpl(), listener.get()));
   listener->NotifyDirectListenerInstalled(
       DirectMediaStreamTrackListener::InstallationResult::SUCCESS);
 
   // Pass buffered data to the listener
   VideoSegment bufferedData;
   size_t videoFrames = 0;
-  // For video we append all non-null chunks, as we're only interested in
-  // real frames and their timestamps.
   VideoSegment& trackSegment = static_cast<VideoSegment&>(*track->GetSegment());
   for (VideoSegment::ConstChunkIterator iter(trackSegment); !iter.IsEnded();
        iter.Next()) {
-    if (iter->IsNull()) {
+    if (iter->mTimeStamp.IsNull()) {
+      // No timestamp means this is only for the graph's internal book-keeping,
+      // denoting a late start of the track.
       continue;
     }
     ++videoFrames;
-    MOZ_ASSERT(!iter->mTimeStamp.IsNull());
     bufferedData.AppendFrame(do_AddRef(iter->mFrame.GetImage()),
                              iter->mFrame.GetIntrinsicSize(),
                              iter->mFrame.GetPrincipalHandle(),
                              iter->mFrame.GetForceBlack(), iter->mTimeStamp);
   }
 
   if (TrackData* updateData = FindDataForTrack(aTrackID)) {
     VideoSegment& video = static_cast<VideoSegment&>(*updateData->mData);
     for (VideoSegment::ConstChunkIterator iter(video); !iter.IsEnded();
          iter.Next()) {
-      if (iter->IsNull()) {
-        continue;
-      }
       ++videoFrames;
+      MOZ_ASSERT(!iter->mTimeStamp.IsNull());
       bufferedData.AppendFrame(do_AddRef(iter->mFrame.GetImage()),
                                iter->mFrame.GetIntrinsicSize(),
                                iter->mFrame.GetPrincipalHandle(),
                                iter->mFrame.GetForceBlack(), iter->mTimeStamp);
     }
   }
 
   LOG(LogLevel::Info,
       ("%p: Notifying direct listener %p of %zu video frames and duration "
        "%" PRId64,
        GraphImpl(), listener.get(), videoFrames, bufferedData.GetDuration()));
-  if (!bufferedData.IsNull()) {
-    listener->NotifyRealtimeTrackData(Graph(), 0, bufferedData);
-  }
+  listener->NotifyRealtimeTrackData(Graph(), 0, bufferedData);
 }
 
 void SourceMediaStream::RemoveDirectTrackListenerImpl(
     DirectMediaStreamTrackListener* aListener, TrackID aTrackID) {
   MutexAutoLock lock(mMutex);
   for (int32_t i = mDirectTrackListeners.Length() - 1; i >= 0; --i) {
     const TrackBound<DirectMediaStreamTrackListener>& source =
         mDirectTrackListeners[i];