// The acquire decision for the shared video texture's keyed mutex, factored out so it can be tested // without a D3D device (capture/shared_texture.cpp uses it). #pragma once #include // HRESULT, S_OK, WAIT_ABANDONED, WAIT_TIMEOUT namespace coop { // True when an IDXGIKeyedMutex::AcquireSync result means we now HOLD the mutex and must copy + then // release it. S_OK is the normal case. WAIT_ABANDONED is success-with-recovery: a previous owner // (e.g. a host that crashed while holding it, then reconnected) terminated without releasing, so the // OS hands ownership to us -- treating it as a failure would skip the copy AND leak ownership, so the // next AcquireSync would block forever and the mirror would freeze. Timeout / hard errors mean "we // didn't get it, skip this frame." inline bool keyed_mutex_acquired(HRESULT acquire_result) { return acquire_result == S_OK || acquire_result == static_cast(WAIT_ABANDONED); } } // namespace coop