Bug 1454625 - Schedule settings update before setting mImage. r=padenot

MozReview-Commit-ID: 9IasAgJImuI

--HG--
extra : rebase_source : 67fc9036b72c19f8fa73084053d617537e0cdaca
This commit is contained in:
Andreas Pehrson 2018-04-17 11:14:19 +02:00
parent 9ad67f4c0e
commit 3be3fab400
2 changed files with 9 additions and 12 deletions

View File

@ -621,17 +621,7 @@ MediaEngineRemoteVideoSource::DeliverFrame(uint8_t* aBuffer,
aProps.renderTimeMs()));
#endif
bool sizeChanged = false;
{
MutexAutoLock lock(mMutex);
// implicitly releases last image
sizeChanged = (!mImage && image) ||
(mImage && image && mImage->GetSize() != image->GetSize());
mImage = image.forget();
mImageSize = mImage->GetSize();
}
if (sizeChanged) {
if (mImageSize.width != dst_width || mImageSize.height != dst_height) {
NS_DispatchToMainThread(NS_NewRunnableFunction(
"MediaEngineRemoteVideoSource::FrameSizeChange",
[settings = mSettings, dst_width, dst_height]() mutable {
@ -640,6 +630,13 @@ MediaEngineRemoteVideoSource::DeliverFrame(uint8_t* aBuffer,
}));
}
{
MutexAutoLock lock(mMutex);
// implicitly releases last image
mImage = image.forget();
mImageSize = mImage->GetSize();
}
// We'll push the frame into the MSG on the next Pull. This will avoid
// swamping the MSG with frames should it be taking longer than normal to run
// an iteration.

View File

@ -224,7 +224,7 @@ private:
// The intrinsic size of the latest captured image, so we can feed black
// images of the same size while stopped.
// Set under mMutex on the owning thread. Accessed under one of the two.
// Set under mMutex on the Cameras IPC thread. Accessed under one of the two.
gfx::IntSize mImageSize = gfx::IntSize(0, 0);
// The current settings of this source.