summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2018-01-12 14:35:51 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-01-15 07:29:08 +0000
commitd83467be15486090ee23709dc325c2c28d34c0cd (patch)
treef8fe7590f8fc11340196af66a9a6e8cdfff0a88b /src
parentd405f87569b47d8e420f7bc6aee04f477663c92e (diff)
downloadqtmultimedia-d83467be15486090ee23709dc325c2c28d34c0cd.tar.gz
Revert "DirectShow: Fix memory leak in CLSID_FilterGraph"v5.9.45.9.4
The reverted commit brakes rendering on video on Windows; only the first frame is delivered. This reverts commit 8ec92863f13061c3dd2d56376eddfe258915589f. Task-number: QTBUG-65736 Change-Id: I298da5803efe13d0f17868714393cc9b1760b4a7 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp31
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h4
2 files changed, 8 insertions, 27 deletions
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
index 2218ca5ed..8ee5d67a1 100644
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ b/src/plugins/directshow/player/directshowplayerservice.cpp
@@ -318,15 +318,18 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream
m_graphStatus = InvalidMedia;
m_error = QMediaPlayer::ResourceError;
} else {
+ // {36b73882-c2c8-11cf-8b46-00805f6cef60}
+ static const GUID iid_IFilterGraph2 = {
+ 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} };
m_graphStatus = Loading;
+ m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2);
+
if (stream)
m_pendingTasks = SetStreamSource;
else
m_pendingTasks = SetUrlSource;
- m_pendingTasks |= CreateGraph;
-
::SetEvent(m_taskHandle);
}
@@ -337,17 +340,6 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream
updateStatus();
}
-void DirectShowPlayerService::doCreateGraph(QMutexLocker *locker)
-{
- Q_UNUSED(locker);
-
- // {36b73882-c2c8-11cf-8b46-00805f6cef60}
- static const GUID iid_IFilterGraph2 = {
- 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} };
-
- m_graph = com_new<IFilterGraph2>(CLSID_FilterGraphNoThread, iid_IFilterGraph2);
-}
-
void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
{
IBaseFilter *source = 0;
@@ -1694,8 +1686,6 @@ void DirectShowPlayerService::run()
{
QMutexLocker locker(&m_mutex);
- CoInitialize(NULL);
-
for (;;) {
while (m_pendingTasks == 0) {
DWORD result = 0;
@@ -1710,17 +1700,12 @@ void DirectShowPlayerService::run()
}
locker.relock();
- if (m_graph && result == WAIT_OBJECT_0 + 1) {
+ if (result == WAIT_OBJECT_0 + 1) {
graphEvent(&locker);
}
}
- if (m_pendingTasks & CreateGraph) {
- m_pendingTasks ^= CreateGraph;
- m_executingTask = CreateGraph;
-
- doCreateGraph(&locker);
- } else if (m_pendingTasks & ReleaseGraph) {
+ if (m_pendingTasks & ReleaseGraph) {
m_pendingTasks ^= ReleaseGraph;
m_executingTask = ReleaseGraph;
@@ -1813,8 +1798,6 @@ void DirectShowPlayerService::run()
}
m_executingTask = 0;
}
-
- CoUninitialize();
}
QT_END_NAMESPACE
diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h
index cc7b4dd3e..01d05449e 100644
--- a/src/plugins/directshow/player/directshowplayerservice.h
+++ b/src/plugins/directshow/player/directshowplayerservice.h
@@ -124,7 +124,6 @@ private:
void run();
- void doCreateGraph(QMutexLocker *locker);
void doSetUrlSource(QMutexLocker *locker);
void doSetStreamSource(QMutexLocker *locker);
void doRender(QMutexLocker *locker);
@@ -170,8 +169,7 @@ private:
ReleaseVideoProbe = 0x40000,
ReleaseFilters = ReleaseGraph | ReleaseAudioOutput
| ReleaseVideoOutput | ReleaseAudioProbe
- | ReleaseVideoProbe,
- CreateGraph = 0x80000
+ | ReleaseVideoProbe
};
enum Event