Bug 1536766 - Don't ignore null frames in MediaStreamGraph. r=padenot
authorAndreas Pehrson <apehrson@mozilla.com>
Wed, 24 Apr 2019 10:55:41 +0000
changeset 529442 46eb056738352e581e6e334ce4ad0f84fd4a0f07
parent 529441 0bdfa8fcd3c255c5ac90eeb5875305f8d5dc275c
child 529443 32d459a421329ef10b8b609795053d4debcea408
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
@@ -2774,54 +2774,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];