From 294882d83b1b6a0ff6a590a0ddf4338586cd2a94 Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Thu, 19 Mar 2020 17:04:22 +0000 Subject: [PATCH] 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 --- .../modules/video_capture/objc/rtc_video_capture_objc.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm b/media/webrtc/trunk/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm index 2fb7e139fba0..a98585a97375 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm +++ b/media/webrtc/trunk/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm @@ -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); }