diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index 19cd0f8ff..d4da10fd7 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -1350,7 +1350,16 @@ int spa_libcamera_stream_on(struct impl *impl) impl->source.data = impl; impl->source.mask = SPA_IO_IN | SPA_IO_ERR; impl->source.rmask = 0; - res = spa_loop_add_source(impl->data_loop, &impl->source); + + res = spa_loop_locked( + impl->data_loop, + [](spa_loop *, bool, uint32_t, const void *, size_t, void *user_data) + { + auto *impl = static_cast(user_data); + return spa_loop_add_source(impl->data_loop, &impl->source); + }, + 0, nullptr, 0, impl + ); if (res < 0) goto err_close_source;