Bug 1556696 - Only fail the VideoFrameConverter out-of-buffers assert if we dropped 100 frames in a row. r=dminor

Five buffers is evidently not enough to ensure we don't run out.
What we really want the assert for is that we are not leaking buffers so that
they never recycle, while also keeping memory usage down. This achieves that
by allowing for 100 frames to drop before failing the out-of-buffers assert.

Differential Revision: https://phabricator.services.mozilla.com/D35324

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-06-20 15:19:01 +00:00
Родитель 8361aefc97
Коммит 755d2fbfa4
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -309,14 +309,16 @@ class VideoFrameConverter {
rtc::scoped_refptr<webrtc::I420Buffer> buffer =
mBufferPool.CreateBuffer(aSize.width, aSize.height);
if (!buffer) {
MOZ_DIAGNOSTIC_ASSERT(false,
"Buffers not leaving scope except for "
"reconfig, should never leak");
MOZ_DIAGNOSTIC_ASSERT(++mFramesDropped <= 100, "Buffers must be leaking");
MOZ_LOG(gVideoFrameConverterLog, LogLevel::Warning,
("Creating a buffer failed"));
return;
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
mFramesDropped = 0;
#endif
nsresult rv =
ConvertToI420(aImage, buffer->MutableDataY(), buffer->StrideY(),
buffer->MutableDataU(), buffer->StrideU(),
@ -349,6 +351,9 @@ class VideoFrameConverter {
TimeStamp mLastFrameQueuedForProcessing;
UniquePtr<webrtc::VideoFrame> mLastFrameConverted;
bool mEnabled;
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
size_t mFramesDropped = 0;
#endif
nsTArray<RefPtr<VideoConverterListener>> mListeners;
};