Bug 1621500 - Null out _owner in RTCVideoCaptureIosObjC; r=ng

We're seeing what looks like occasional late callbacks in
VideoCaptureImpl::DeliverCapturedFrame on OS X. When we call stopCapture, it in
turns calls directOutputToNil which should cause any newly capture frames to be
dropped. It is not clear from the existing code or the documentation what would
happen to any frames which are already enqueued. It looks like it is possible
for frames to be delivered on the old queue, which would explain late callbacks.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dan Minor 2020-03-19 17:04:22 +00:00
Родитель 04f7ed2b63
Коммит 294882d83b
1 изменённых файлов: 4 добавлений и 1 удалений

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

@ -240,6 +240,7 @@ using namespace webrtc::videocapturemodule;
_orientationHasChanged = NO;
[self waitForCaptureChangeToFinish];
[self directOutputToNil];
_owner = NULL;
if (!_captureSession) {
return NO;
@ -325,7 +326,9 @@ using namespace webrtc::videocapturemodule;
tempCaptureCapability.maxFPS = _capability.maxFPS;
tempCaptureCapability.videoType = VideoType::kUYVY;
_owner->IncomingFrame(baseAddress, frameSize, tempCaptureCapability, 0);
if (_owner) {
_owner->IncomingFrame(baseAddress, frameSize, tempCaptureCapability, 0);
}
CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
}