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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-04-24 10:55:41 +00:00
parent cc6262e7c7
commit 19834afbea

View File

@ -2779,16 +2779,15 @@ void SourceMediaStream::AddDirectTrackListenerImpl(
// 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(),
@ -2799,10 +2798,8 @@ void SourceMediaStream::AddDirectTrackListenerImpl(
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(),
@ -2814,9 +2811,7 @@ void SourceMediaStream::AddDirectTrackListenerImpl(
("%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(