summaryrefslogtreecommitdiff
path: root/src/plugins/directshow/player
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2016-07-05 13:21:31 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-07-06 07:35:57 +0000
commitfd89c0946a378812121615ab6b8a3ad1ae93d4fb (patch)
treef986cfd07efe613236b66ada586cac9fd7020926 /src/plugins/directshow/player
parent443ed0be093b2d8e78d111a59eca97f2eba5b0fe (diff)
downloadqtmultimedia-fd89c0946a378812121615ab6b8a3ad1ae93d4fb.tar.gz
DirectShow: correctly clear surface in EVR presenter
The surface was never cleared in the EVR presenter. It could lead to situations where the presenter would use a destroyed surface. Change-Id: If2223f09f6f8c20c06345bed40803da10dcf4ae3 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/directshow/player')
-rw-r--r--src/plugins/directshow/player/directshowvideorenderercontrol.cpp24
-rw-r--r--src/plugins/directshow/player/directshowvideorenderercontrol.h6
2 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp b/src/plugins/directshow/player/directshowvideorenderercontrol.cpp
index 027d2ce55..b5dbfef9e 100644
--- a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp
+++ b/src/plugins/directshow/player/directshowvideorenderercontrol.cpp
@@ -46,11 +46,20 @@ DirectShowVideoRendererControl::DirectShowVideoRendererControl(DirectShowEventLo
, m_loop(loop)
, m_surface(0)
, m_filter(0)
+#ifdef HAVE_EVR
+ , m_evrPresenter(0)
+#endif
{
}
DirectShowVideoRendererControl::~DirectShowVideoRendererControl()
{
+#ifdef HAVE_EVR
+ if (m_evrPresenter) {
+ m_evrPresenter->setSurface(Q_NULLPTR);
+ m_evrPresenter->Release();
+ }
+#endif
if (m_filter)
m_filter->Release();
}
@@ -65,6 +74,14 @@ void DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
if (m_surface == surface)
return;
+#ifdef HAVE_EVR
+ if (m_evrPresenter) {
+ m_evrPresenter->setSurface(Q_NULLPTR);
+ m_evrPresenter->Release();
+ m_evrPresenter = 0;
+ }
+#endif
+
if (m_filter) {
m_filter->Release();
m_filter = 0;
@@ -75,12 +92,13 @@ void DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
if (m_surface) {
#ifdef HAVE_EVR
m_filter = com_new<IBaseFilter>(clsid_EnhancedVideoRenderer);
- EVRCustomPresenter *evrPresenter = new EVRCustomPresenter(m_surface);
- if (!evrPresenter->isValid() || !qt_evr_setCustomPresenter(m_filter, evrPresenter)) {
+ m_evrPresenter = new EVRCustomPresenter(m_surface);
+ if (!m_evrPresenter->isValid() || !qt_evr_setCustomPresenter(m_filter, m_evrPresenter)) {
m_filter->Release();
m_filter = 0;
+ m_evrPresenter->Release();
+ m_evrPresenter = 0;
}
- evrPresenter->Release();
if (!m_filter)
#endif
diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.h b/src/plugins/directshow/player/directshowvideorenderercontrol.h
index d08d124ca..e3d0a5f23 100644
--- a/src/plugins/directshow/player/directshowvideorenderercontrol.h
+++ b/src/plugins/directshow/player/directshowvideorenderercontrol.h
@@ -39,6 +39,9 @@
#include "qvideorenderercontrol.h"
class DirectShowEventLoop;
+#ifdef HAVE_EVR
+class EVRCustomPresenter;
+#endif
QT_USE_NAMESPACE
@@ -61,6 +64,9 @@ private:
DirectShowEventLoop *m_loop;
QAbstractVideoSurface *m_surface;
IBaseFilter *m_filter;
+#ifdef HAVE_EVR
+ EVRCustomPresenter *m_evrPresenter;
+#endif
};
#endif