avfvideosrc: Don't wait on main thread for permissions request
authorJan Schmidt <jan@centricular.com>
Tue, 28 Feb 2023 19:32:19 +0000 (06:32 +1100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 1 Mar 2023 22:52:01 +0000 (22:52 +0000)
commit633cbbaddb261eb23d5373c4262c63a93ac3f4b4
treea6b773245eaec2a42f1a5d03426bc39a31f65f69
parentbc6eaa6fe2253932b195279c24a45b321c950ceb
avfvideosrc: Don't wait on main thread for permissions request

Recursively invoking the NSMainLoop can cause crashes in
applications that don't expect it. Instead of waiting for
permission to be granted, move the wait later - until we
actually need device permissions when starting the capture
session. That moves the wait into the streaming thread
instead of the application thread that's setting the pipeline
state to READY.

Instead of a manual state change implementation to open
and close the device, use the basesrc start/stop methods that
are intended for the purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4096>
subprojects/gst-plugins-bad/sys/applemedia/avfvideosrc.m