Shuts down the Media Foundation subsystem This function decrements the reference count and performs actual shutdown when the count reaches zero. This ensures proper cleanup of resources. Safe to call multiple times.
()
| 76 | /// when the count reaches zero. This ensures proper cleanup of resources. |
| 77 | /// Safe to call multiple times. |
| 78 | pub fn shutdown_mf() { |
| 79 | let refcnt = &*CAMERA_REFCNT; |
| 80 | // Decrement reference count with SeqCst to ensure proper synchronization |
| 81 | // SeqCst ensures that all memory operations before this point are visible |
| 82 | // to other threads before we check if we need to shutdown |
| 83 | if refcnt.fetch_sub(1, Ordering::SeqCst) == 1 { |
| 84 | let initialized = &*INITIALIZED; |
| 85 | if initialized.load(Ordering::SeqCst) { |
| 86 | unsafe { |
| 87 | let _ = MFShutdown(); |
| 88 | CoUninitialize(); |
| 89 | } |
| 90 | initialized.store(false, Ordering::SeqCst); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /// Lists all available camera devices connected to the system |
| 96 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected