summaryrefslogtreecommitdiffstats
path: root/src/plugins/common/evr
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-28 16:23:49 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-08-01 13:15:39 +0300
commitd89a4269ce1d9729842a508d97e1f1aeaf7305ee (patch)
tree0f13df650acb187ca8b1cc05c17b9577cb3e4cab /src/plugins/common/evr
parent435557691c3c28e9c63aa4bb5f4b9ec8fe3f8923 (diff)
Port from QMutex::Recursive to QRecursiveMutex
Also port from QMutexLocker to std::lock_guard or std::unique_lock, as the former will not support QRecursiveMutex going forward. Change-Id: I1ed1a129e2b9b77aa0a729e8cab03c673566a345 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Diffstat (limited to 'src/plugins/common/evr')
-rw-r--r--src/plugins/common/evr/evrcustompresenter.cpp28
-rw-r--r--src/plugins/common/evr/evrcustompresenter.h2
2 files changed, 16 insertions, 14 deletions
diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp
index 3de8d3ac3..ef2e02220 100644
--- a/src/plugins/common/evr/evrcustompresenter.cpp
+++ b/src/plugins/common/evr/evrcustompresenter.cpp
@@ -50,6 +50,9 @@
#include <qcoreapplication.h>
#include <qmath.h>
#include <QtCore/qdebug.h>
+
+#include <mutex>
+
#include <float.h>
#include <evcode.h>
@@ -542,7 +545,6 @@ EVRCustomPresenter::EVRCustomPresenter(QAbstractVideoSurface *surface)
, m_sampleFreeCB(this, &EVRCustomPresenter::onSampleFree)
, m_refCount(1)
, m_renderState(RenderShutdown)
- , m_mutex(QMutex::Recursive)
, m_scheduler(this)
, m_tokenCounter(0)
, m_sampleNotify(false)
@@ -658,7 +660,7 @@ HRESULT EVRCustomPresenter::InitServicePointers(IMFTopologyServiceLookup *lookup
HRESULT hr = S_OK;
DWORD objectCount = 0;
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
// Do not allow initializing when playing or paused.
if (isActive())
@@ -738,7 +740,7 @@ HRESULT EVRCustomPresenter::ProcessMessage(MFVP_MESSAGE_TYPE message, ULONG_PTR
{
HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
hr = checkShutdown();
if (FAILED(hr))
@@ -805,7 +807,7 @@ HRESULT EVRCustomPresenter::GetCurrentMediaType(IMFVideoMediaType **mediaType)
*mediaType = NULL;
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
hr = checkShutdown();
if (FAILED(hr))
@@ -819,7 +821,7 @@ HRESULT EVRCustomPresenter::GetCurrentMediaType(IMFVideoMediaType **mediaType)
HRESULT EVRCustomPresenter::OnClockStart(MFTIME, LONGLONG clockStartOffset)
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
// We cannot start after shutdown.
HRESULT hr = checkShutdown();
@@ -854,7 +856,7 @@ HRESULT EVRCustomPresenter::OnClockStart(MFTIME, LONGLONG clockStartOffset)
HRESULT EVRCustomPresenter::OnClockRestart(MFTIME)
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
HRESULT hr = checkShutdown();
if (FAILED(hr))
@@ -878,7 +880,7 @@ HRESULT EVRCustomPresenter::OnClockRestart(MFTIME)
HRESULT EVRCustomPresenter::OnClockStop(MFTIME)
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
HRESULT hr = checkShutdown();
if (FAILED(hr))
@@ -898,7 +900,7 @@ HRESULT EVRCustomPresenter::OnClockStop(MFTIME)
HRESULT EVRCustomPresenter::OnClockPause(MFTIME)
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
// We cannot pause the clock after shutdown.
HRESULT hr = checkShutdown();
@@ -915,7 +917,7 @@ HRESULT EVRCustomPresenter::OnClockSetRate(MFTIME, float rate)
// The presenter reports its maximum rate through the IMFRateSupport interface.
// Here, we assume that the EVR honors the maximum rate.
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
HRESULT hr = checkShutdown();
if (FAILED(hr))
@@ -943,7 +945,7 @@ HRESULT EVRCustomPresenter::GetSlowestRate(MFRATE_DIRECTION, BOOL, float *rate)
if (!rate)
return E_POINTER;
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
HRESULT hr = checkShutdown();
@@ -960,7 +962,7 @@ HRESULT EVRCustomPresenter::GetFastestRate(MFRATE_DIRECTION direction, BOOL thin
if (!rate)
return E_POINTER;
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
float maxRate = 0.0f;
@@ -982,7 +984,7 @@ HRESULT EVRCustomPresenter::GetFastestRate(MFRATE_DIRECTION direction, BOOL thin
HRESULT EVRCustomPresenter::IsRateSupported(BOOL thin, float rate, float *nearestSupportedRate)
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
float maxRate = 0.0f;
float nearestRate = rate; // If we support rate, that is the nearest.
@@ -1016,7 +1018,7 @@ HRESULT EVRCustomPresenter::IsRateSupported(BOOL thin, float rate, float *neares
void EVRCustomPresenter::supportedFormatsChanged()
{
- QMutexLocker locker(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> locker(m_mutex);
m_canRenderToSurface = false;
m_presentEngine->setHint(D3DPresentEngine::RenderToTexture, false);
diff --git a/src/plugins/common/evr/evrcustompresenter.h b/src/plugins/common/evr/evrcustompresenter.h
index bd04bd952..5b7140b58 100644
--- a/src/plugins/common/evr/evrcustompresenter.h
+++ b/src/plugins/common/evr/evrcustompresenter.h
@@ -339,7 +339,7 @@ private:
RenderState m_renderState;
FrameStep m_frameStep;
- QMutex m_mutex;
+ QRecursiveMutex m_mutex;
// Samples and scheduling
Scheduler m_scheduler; // Manages scheduling of samples.