Browse Source

obs-qsv11: Fix win7 crash when fake monitor isn't forced

When using QSV is used on a windows 7 machine with a dedicated card, you
have to fake a monitor connection to your Intel graphics to be able to
use QSV.  If you do not, the initialization will fail with an error.
The error for that situation is not handled properly, and a variable
will be used while null.  Instead, the function should safely return
after that error is received.

Also, do not call ClearData in the destructor unless QSV has been
properly initialized (if m_pmfxENC is null).
jp9000 9 years ago
parent
commit
a39cde9d08
1 changed files with 5 additions and 3 deletions
  1. 5 3
      plugins/obs-qsv11/QSV_Encoder_Internal.cpp

+ 5 - 3
plugins/obs-qsv11/QSV_Encoder_Internal.cpp

@@ -126,7 +126,8 @@ QSV_Encoder_Internal::QSV_Encoder_Internal(mfxIMPL& impl, mfxVersion& version) :
 
 QSV_Encoder_Internal::~QSV_Encoder_Internal()
 {
-	ClearData();
+	if (m_pmfxENC)
+		ClearData();
 }
 
 mfxStatus QSV_Encoder_Internal::Open(qsv_param_t * pParams)
@@ -140,8 +141,9 @@ mfxStatus QSV_Encoder_Internal::Open(qsv_param_t * pParams)
 		// Use system memory
 		sts = Initialize(m_impl, m_ver, &m_session, NULL);
 
-	if (sts == MFX_ERR_NONE)
-		m_pmfxENC = new MFXVideoENCODE(m_session);
+	MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+
+	m_pmfxENC = new MFXVideoENCODE(m_session);
 
 	InitParams(pParams);