mediafoundation: fix deadlock when user call shutdown and endGetEvent concurrently
The issue occurs when 'IMFShutdown::Shutdown' is called on MFT on one thread and IMFMediaEventGenerator::EndGetEvent' is called on another thread. Shutdown is taking a lock (m_lockShutdown), changes m_bShutdown to true, then calls OnFlush which takes API lock (m_lock) EndGetEvent and all other API's take an API lock (m_lock), then calls checkshutdownstatus() which takes the m_lockShutdown. So if Shutdown acquires m_lockShutdown and prior to acquiring API lock, and EndGetEvent acquire m_lock, then we have deadlock on m_lockShutdown. Since the CheckShutdownStatus is only checking the m_bShutdown variable, it really doesn't have to be protected by the shutdown lock. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Yubo Xie <yuboxie@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36507>
This commit is contained in:
committed by
Marge Bot
parent
ea6262ca15
commit
71eefb977b
@@ -28,7 +28,6 @@
|
||||
HRESULT
|
||||
CDX12EncHMFT::CheckShutdown( void )
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( m_lockShutdown );
|
||||
if( m_bShutdown )
|
||||
{
|
||||
return MF_E_SHUTDOWN;
|
||||
|
||||
Reference in New Issue
Block a user