lvsti/CoreMediaIO-DAL-Example

Can't get the plugin load in Catalina

videolist opened this issue · 10 comments

Ws able to compile successfully but can't get any of the plugins (Sample or SampleVCam) to load. I am using your Cameo tool to browse the DALs (super nice tool, love those Swift wrappers). But I don't see them there. I wonder if it's a signing issue or I am missing some important steps in how to register them with the system. Any pointers?

Actually I got to the point where Cameo as well as system_profiler SPCameraDataType hangs as soon as I put SampleVCam.plugin into CoreMediaIO/Plig-ins/DAL

Narrowed it down to
err = CMIODPASampleConnect(assistantServicePort, CAProcess::GetPID(), &port);
hanging in CMIO_DPA_Sample_ClientExtras.cpp

I figured it out. It was crashing in the assistant server and therefore the plugin couldn't communicate with it via mach_msg.
Line 34, CMIO_DPA_Sample_Server_VCamDevice.cpp, change:

mFrameCount = ftell(mSequenceFile) / mFrameSize;

to:

mFrameCount = MAX(1, ftell(mSequenceFile) / mFrameSize);

@videolist were you able to get this working then? How were you able to debug it?

My assistant is crashing as well. It looks like it's when EmitFrame is called.

Time Awake Since Boot: 66 seconds

System Integrity Protection: disabled

Crashed Thread:        2

Exception Type:        EXC_ARITHMETIC (SIGFPE)
Exception Codes:       EXC_I386_DIV (divide by zero)
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Floating point exception: 8
Termination Reason:    Namespace SIGNAL, Code 0x8
Terminating Process:   exc handler [646]

Application Specific Information:
dyld2 mode

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff78fff21a mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff78fff768 mach_msg + 60
2   libsystem_kernel.dylib        	0x00007fff7901674a mach_msg_server + 378
3   SampleVCamAssistant           	0x0000000104d32056 main + 646 (CMIO_DPA_Sample_VCamServer.cpp:89)
4   libdyld.dylib                 	0x00007fff78eca3d5 start + 1

Thread 1:
0   libsystem_kernel.dylib        	0x00007fff79002866 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff790c156e _pthread_cond_wait + 722
2   SampleVCamAssistant           	0x0000000104cf26bf CAGuard::Wait() + 191 (CAGuard.cpp:120)
3   SampleVCamAssistant           	0x0000000104d21b09 CAGuard::Locker::Wait() + 25 (CAGuard.h:118)
4   SampleVCamAssistant           	0x0000000104d27e40 CMIO::DPA::Sample::Server::Deck::SimulationEntry(CMIO::DPA::Sample::Server::Deck&) + 384 (CMIO_DPA_Sample_Server_Deck.cpp:518)
5   SampleVCamAssistant           	0x0000000104cf3798 CAPThread::Entry(CAPThread*) + 280 (CAPThread.cpp:315)
6   libsystem_pthread.dylib       	0x00007fff790be2eb _pthread_body + 126
7   libsystem_pthread.dylib       	0x00007fff790c1249 _pthread_start + 66
8   libsystem_pthread.dylib       	0x00007fff790bd40d thread_start + 13

Thread 2 Crashed:
0   SampleVCamAssistant           	0x0000000104d3250a CMIO::DPA::Sample::Server::VCamDevice::EmitFrame(void*) + 90
1   libsystem_pthread.dylib       	0x00007fff790be2eb _pthread_body + 126
2   libsystem_pthread.dylib       	0x00007fff790c1249 _pthread_start + 66
3   libsystem_pthread.dylib       	0x00007fff790bd40d thread_start + 13

Thread 3:
0   libsystem_pthread.dylib       	0x00007fff790bd3f0 start_wqthread + 0

Thread 2 crashed with X86 Thread State (64-bit):
  rax: 0x6674616c50540010  rbx: 0x000070000864e000  rcx: 0x00007fa3e550d9f0  rdx: 0x0000000000000000
  rdi: 0x00007fffaf647030  rsi: 0x0000000000000000  rbp: 0x000070000864df10  rsp: 0x000070000864dec0
   r8: 0x0000000000000000   r9: 0x0000000000000000  r10: 0x0000000000000001  r11: 0x0000000000000247
  r12: 0x0000000000000000  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000000
  rip: 0x0000000104d3250a  rfl: 0x0000000000010246  cr2: 0x00007fffecf7d002

@videolist I had the same problem -- it's because the .yuv video files are in git-lfs. Normally you'd do a git-lfs pull to download them but it looks like this repository is over its Git LFS quota for GitHub.

Instead, what you can do is download the videos from the original Apple sample page and overwrite the git-lfs stubs (Sources/Extras/CoreMediaIO/DeviceAbstractionLayer/Devices/Sample/KernelExtension/*.yuv)

lvsti commented

@johnboiles thanks for linking the alternate download location, indeed LFS has been suspended for my account because a surge of downloads consumed my quota. 🤷‍♂

@videolist Do you know if I need to install the kext as well? I'm building on Catalina without errors, but after adding SampleVCam.plugin, I don't see anything in Cameo.

@videolist Gotcha, that worked, thanks! Just FYI if you committed that change, it didn't get pushed to this repo.