Backed out changeset 8c8ff2c7bfa1 (bug 1485536) for crashes at VideoSink. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2018-08-26 00:15:16 +03:00
Родитель 5ab3282a07
Коммит 15876458af
4 изменённых файлов: 19 добавлений и 53 удалений

Просмотреть файл

@ -39,16 +39,11 @@ struct FrameStatisticsData
uint64_t mInterKeyFrameMax_us = 0;
FrameStatisticsData() = default;
FrameStatisticsData(uint64_t aParsed,
uint64_t aDecoded,
uint64_t aDropped,
uint64_t aPresented)
FrameStatisticsData(uint64_t aParsed, uint64_t aDecoded, uint64_t aDropped)
: mParsedFrames(aParsed)
, mDecodedFrames(aDecoded)
, mPresentedFrames(aPresented)
, mDroppedFrames(aDropped)
{
}
{}
void
Accumulate(const FrameStatisticsData& aStats)
@ -120,7 +115,7 @@ public:
// Increments the parsed and decoded frame counters by the passed in counts.
// Can be called on any thread.
void Accumulate(const FrameStatisticsData& aStats)
void NotifyDecodedFrames(const FrameStatisticsData& aStats)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mFrameStatisticsData.Accumulate(aStats);
@ -147,7 +142,7 @@ public:
~AutoNotifyDecoded()
{
if (mFrameStats) {
mFrameStats->Accumulate(mStats);
mFrameStats->NotifyDecodedFrames(mStats);
}
}

Просмотреть файл

@ -2808,7 +2808,7 @@ MediaFormatReader::DropDecodedSamples(TrackType aTrack)
decoder.mOutput.Clear();
decoder.mSizeOfQueue -= lengthDecodedQueue;
if (aTrack == TrackInfo::kVideoTrack && mFrameStats) {
mFrameStats->Accumulate({ 0, 0, lengthDecodedQueue, 0 });
mFrameStats->NotifyDecodedFrames({ 0, 0, lengthDecodedQueue });
}
}
@ -2840,7 +2840,7 @@ MediaFormatReader::VideoSkipReset(uint32_t aSkipped)
DropDecodedSamples(TrackInfo::kVideoTrack);
// Report the pending frames as dropped.
if (mFrameStats) {
mFrameStats->Accumulate({ 0, 0, SizeOfVideoQueueInFrames(), 0 });
mFrameStats->NotifyDecodedFrames({ 0, 0, SizeOfVideoQueueInFrames() });
}
// Cancel any pending demux request and pending demuxed samples.
@ -2848,7 +2848,7 @@ MediaFormatReader::VideoSkipReset(uint32_t aSkipped)
Reset(TrackType::kVideoTrack);
if (mFrameStats) {
mFrameStats->Accumulate({ aSkipped, 0, aSkipped, 0 });
mFrameStats->NotifyDecodedFrames({ aSkipped, 0, aSkipped });
}
mVideo.mNumSamplesSkippedTotal += aSkipped;

Просмотреть файл

@ -47,9 +47,7 @@ VideoSink::VideoSink(AbstractThread* aThread,
, mContainer(aContainer)
, mProducerID(ImageContainer::AllocateProducerID())
, mFrameStats(aFrameStats)
, mOldCompositorDroppedCount(mContainer ? mContainer->GetDroppedImageCount()
: 0)
, mPendingDroppedCount(0)
, mOldDroppedCount(0)
, mHasVideo(false)
, mUpdateScheduler(aThread)
, mVideoQueueSendToCompositorSize(aVQueueSentToCompositerSize)
@ -67,8 +65,6 @@ VideoSink::~VideoSink()
#ifdef XP_WIN
MOZ_ASSERT(!mHiResTimersRequested);
#endif
MOZ_DIAGNOSTIC_ASSERT(mPendingDroppedCount == 0,
"All dropped frames should have been reported");
}
const MediaSink::PlaybackParams&
@ -469,6 +465,13 @@ VideoSink::RenderVideoFrames(int32_t aMaxFrames,
if (images.Length() > 0) {
mContainer->SetCurrentFrames(frames[0]->mDisplay, images);
uint32_t droppedCount = mContainer->GetDroppedImageCount();
uint32_t dropped = droppedCount - mOldDroppedCount;
if (dropped > 0) {
mFrameStats.NotifyDecodedFrames({0, 0, dropped});
mOldDroppedCount = droppedCount;
VSINK_LOG_V("%u video frame discarded by compositor", dropped);
}
}
}
@ -483,9 +486,6 @@ VideoSink::UpdateRenderedVideoFrames()
const auto clockTime = mAudioSink->GetPosition(&nowTime);
MOZ_ASSERT(!clockTime.IsNegative(), "Should have positive clock time.");
uint32_t sentToCompositorCount = 0;
uint32_t droppedCount = 0;
// Skip frames up to the playback position.
TimeUnit lastFrameEndTime;
while (VideoQueue().GetSize() > mMinVideoQueueSize &&
@ -493,35 +493,14 @@ VideoSink::UpdateRenderedVideoFrames()
RefPtr<VideoData> frame = VideoQueue().PopFront();
lastFrameEndTime = frame->GetEndTime();
if (frame->IsSentToCompositor()) {
sentToCompositorCount++;
mFrameStats.NotifyPresentedFrame();
} else {
droppedCount++;
mFrameStats.NotifyDecodedFrames({ 0, 0, 1 });
VSINK_LOG_V("discarding video frame mTime=%" PRId64 " clock_time=%" PRId64,
frame->mTime.ToMicroseconds(), clockTime.ToMicroseconds());
}
}
if (droppedCount || sentToCompositorCount) {
uint32_t totalCompositorDroppedCount = mContainer->GetDroppedImageCount();
uint32_t compositorDroppedCount =
totalCompositorDroppedCount - mOldCompositorDroppedCount;
if (compositorDroppedCount > 0) {
mOldCompositorDroppedCount = totalCompositorDroppedCount;
VSINK_LOG_V("%u video frame previously discarded by compositor",
compositorDroppedCount);
}
mPendingDroppedCount += compositorDroppedCount;
uint32_t droppedReported = mPendingDroppedCount > sentToCompositorCount
? sentToCompositorCount
: mPendingDroppedCount;
mPendingDroppedCount -= droppedReported;
mFrameStats.Accumulate({ 0,
0,
droppedCount + droppedReported,
sentToCompositorCount - droppedReported });
}
// The presentation end time of the last video frame displayed is either
// the end time of the current frame, or if we dropped all frames in the
// queue, the end time of the last frame we removed from the queue.
@ -569,14 +548,7 @@ VideoSink::MaybeResolveEndPromise()
if (VideoQueue().GetSize() == 1) {
// Remove the last frame since we have sent it to compositor.
RefPtr<VideoData> frame = VideoQueue().PopFront();
if (mPendingDroppedCount > 0) {
// We won't get a chance to report the frames dropped later so report
// them all now.
mFrameStats.Accumulate({ 0, 0, mPendingDroppedCount, 0 });
mPendingDroppedCount = 0;
} else {
mFrameStats.NotifyPresentedFrame();
}
mFrameStats.NotifyPresentedFrame();
}
mEndPromiseHolder.ResolveIfExists(true, __func__);
}

Просмотреть файл

@ -132,8 +132,7 @@ private:
// The presentation end time of the last video frame which has been displayed.
TimeUnit mVideoFrameEndTime;
uint32_t mOldCompositorDroppedCount;
uint32_t mPendingDroppedCount;
uint32_t mOldDroppedCount;
// Event listeners for VideoQueue
MediaEventListener mPushListener;