open-webrtc-toolkit / owt-client-native

Open WebRTC Toolkit client SDK for native Windows/Linux/iOS applications.
https://01.org/open-webrtc-toolkit
Apache License 2.0
389 stars 181 forks source link

`mfxSession` close twice #599

Open Meonardo opened 2 years ago

Meonardo commented 2 years ago

Hi, owt team, recently I got a crash while using hardware acceleration features by setting SetVideoHardwareAccelerationEnabled to true.

I found: below 2 members

// Begin MSDK variables
MFXVideoSession* m_mfx_session_;
std::unique_ptr<MFXVideoDECODE> m_pmfx_dec_;

in class MSDKVideoDecoder, AfterMSDKVideoDecoder::Release() is called, in MSDKFactory::DestroySession() the m_mfx_session_ will be deleted, so mfxSession in MFXVideoSession will be closed, the problem is: the SAME mfxSession object which is also in MFXVideoDECODE get refered when MSDKVideoDecoder::~MSDKVideoDecoder() is called, so I got "Access Violation" exception.