summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2016-12-20 15:45:28 +0100
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2017-01-03 07:46:31 +0000
commitb4211c1c233933d109bc71b640013e14afc58d4a (patch)
tree928949e8bc3f4f69b1100f4f287ec940b51133f7
parentfc50058455536b857d101166f8c003e83aed4f99 (diff)
winrt: Fix pause/play for videos
This is partially a revert of bff19dbe6733d245. While that commit fixed switching cameras it did not respect pausing a video, where setActive is called from a different thread than in the camera case. Using shutdown introduced a wait, which in that case deadlocked. Instead revert to request an interrupt, but when restarting make sure that the render thread is on hold before start is invoked. Task-number: QTBUG-53722 Change-Id: Id5a722911bb2c30509fabb73bec925cadbf77628 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp b/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp
index 561d9e03c..b3fd11111 100644
--- a/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp
+++ b/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp
@@ -356,6 +356,13 @@ void QWinRTAbstractVideoRendererControl::setActive(bool active)
if (!d->surface)
return;
+ // This only happens for quick restart scenarios, for instance
+ // when switching cameras.
+ if (d->renderThread.isRunning() && d->renderThread.isInterruptionRequested()) {
+ CriticalSectionLocker lock(&d->mutex);
+ d->renderThread.wait();
+ }
+
if (!d->surface->isActive())
d->surface->start(d->format);
@@ -363,7 +370,8 @@ void QWinRTAbstractVideoRendererControl::setActive(bool active)
return;
}
- shutdown();
+ d->renderThread.requestInterruption();
+
if (d->surface && d->surface->isActive())
d->surface->stop();
}