Skip to content

Commit

Permalink
Cherry-pick 6c86b50. rdar://126717672
Browse files Browse the repository at this point in the history
    [iOS] CRASH: exception thrown from AVVideoCaptureSource::stopSession()
    https://bugs.webkit.org/show_bug.cgi?id=273088
    rdar://126717672

    Reviewed by Eric Carlson.

    Crashtracer data shows that an exception is thrown from -[AVCaptureSession stopRunning] because that
    method is called after -beginConfiguration, but before -commitConfiguration. Make this method robust
    to that exception, and add our own ASSERT that we are not in the middle of configuration in order to
    catch this case before it gets to AVCapture.

    * Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:
    (WebCore::AVVideoCaptureSource::stopSession):

    Canonical link: https://commits.webkit.org/277869@main
  • Loading branch information
jernoble authored and Mohsin Qureshi committed Apr 23, 2024
1 parent 81c26e6 commit 40a1b70
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,14 @@ static double cameraZoomScaleFactor(AVCaptureDeviceType deviceType)

void AVVideoCaptureSource::stopSession()
{
[m_session stopRunning];
ASSERT(!m_beginConfigurationCount);

@try {
[m_session stopRunning];
} @catch(NSException *exception) {
ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "error calling -stopRunning ", [[exception name] UTF8String], ", reason : ", exception.reason);
}

rejectPendingPhotoRequest("Track stopped"_s);
}

Expand Down

0 comments on commit 40a1b70

Please sign in to comment.