akvirtualcamera
akvirtualcamera copied to clipboard
Idea: move xpc_connection_create_mach_service to NSXPCConnection so that it works with QuickTime
QuickTime does not work with the webcam because it does not allow accessing xpc_connection_create_mach_service
.
Moving to NSXPCConnection
(sorry, I don't know the C++ equivalent) fixes the problem:
https://github.com/obsproject/obs-studio/blob/dde4d57d726ed6d9e244ffbac093d8ef54e29f44/plugins/mac-virtualcam/src/obs-plugin/OBSDALMachServer.mm https://stackoverflow.com/questions/54188295/nsmachbootstrapserver-is-deprecated-how-can-nsxpcconnection-be-used-to-register
I was looking all information about NSXPCConnection, and did not found any evidence that using the CoreFoudation libraries instead of libxpc makes any difference, libxpc hasn't been deprecated, and libxpc is still the base library for CoreFoudation libraries. If the virtual camera doesn't works with QuickTime, is most probably because the virtual camera isn't signed, which I won't do.
I had closed this issue because I am not entirely sure why it does not work in QuickTime. I signed the plugin but this did not help. Interestingly other cameras (for instance https://github.com/johnboiles/coremediaio-dal-minimal-example) show up in QuickTime (even if not signed).
The problem is that debugging is very hard because the plugin cannot write to a log file in (/tmp) nor send debug XPC messages to the server.
The problem is that debugging is very hard because the plugin cannot write to a log file in (/tmp) nor send debug XPC messages to the server.
You can debug both, the plugin and the service, setting the loglevel:
AkVcamManager set-loglevel 7
and the StandardOutPath and the StandardErrorPath variables in org.webcamoid.cmio.AkVCam.Assistant.plist.
It's all documented in the wiki.
I know, but this does not work when the plugin is loaded by QuickTime.
I tried to write to a logging file using the working camera from the link above, and even there logging does not work (though the camera itself shows up in QuickTime).
I suspect that the QuickTime sandbox prevents all file access (and possibly some XPC stuff).
Running QuickTime from terminal throw some messages?
I re-opened the issue because you said it was working with the other virtual camera. I'm right now quite busy working with Webcamoid, I won't come back to this issue until much later, but it would be useful if you can continue debugging it and give me some updates.
Ok, I will keep you posted. But at the moment I have run out of ideas.
I found the problem: QuickTime does not allow accessing the preferences file which is used by the plugin (Preferences.h). XPC seems to work fine but no devices are shown due to lack of access to the preferences file.
Ok, then the idea would be reading the preferences from the service, similar to what I did with the DirectShow plugin.
I did some testing. When using XPC for getting the device info instead of the preferences file then QuickTime works (even without signing).