summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Wolff <Oliver.Wolff@qt.io>2018-06-22 08:12:37 +0200
committerOliver Wolff <oliver.wolff@qt.io>2018-06-22 07:23:51 +0000
commite2fb22c15a53372f768aa362c37caa0d6f4b57c8 (patch)
treee06c3cdd4c06e08acc7d3fa28b96206212a9230b
parentbc8f1704fcbeb07fe88970521301c57f33d0ca5f (diff)
downloadqtmultimedia-e2fb22c15a53372f768aa362c37caa0d6f4b57c8.tar.gz
winrt: Obtain new camera sample format and size on camera change
By Resetting d->cameraSampleformat to Format_User when the selected video device is changed we make QWinRTCameraVideoRendererControl reobtain the camera sample format and size during the next call of queueBuffer. This is needed as the new camera might have other values for these, which might result in a white screen after a camera change. Task-number: QTBUG-67417 Change-Id: I29e28ddf4fc278aff00ad824bda61aedad91471d Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
-rw-r--r--src/plugins/winrt/qwinrtcameracontrol.cpp2
-rw-r--r--src/plugins/winrt/qwinrtcameravideorenderercontrol.cpp6
-rw-r--r--src/plugins/winrt/qwinrtcameravideorenderercontrol.h3
3 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp
index 0eec4a2ca..164a958ff 100644
--- a/src/plugins/winrt/qwinrtcameracontrol.cpp
+++ b/src/plugins/winrt/qwinrtcameracontrol.cpp
@@ -583,6 +583,8 @@ QWinRTCameraControl::QWinRTCameraControl(QObject *parent)
connect(d->videoRenderer, &QWinRTCameraVideoRendererControl::bufferRequested,
this, &QWinRTCameraControl::onBufferRequested);
d->videoDeviceSelector = new QWinRTVideoDeviceSelectorControl(this);
+ connect(d->videoDeviceSelector, QOverload<int>::of(&QWinRTVideoDeviceSelectorControl::selectedDeviceChanged),
+ d->videoRenderer, &QWinRTCameraVideoRendererControl::resetSampleFormat);
d->imageCaptureControl = new QWinRTCameraImageCaptureControl(this);
d->imageEncoderControl = new QWinRTImageEncoderControl(this);
d->cameraFlashControl = new QWinRTCameraFlashControl(this);
diff --git a/src/plugins/winrt/qwinrtcameravideorenderercontrol.cpp b/src/plugins/winrt/qwinrtcameravideorenderercontrol.cpp
index 03d107ae8..6c5e3dbf9 100644
--- a/src/plugins/winrt/qwinrtcameravideorenderercontrol.cpp
+++ b/src/plugins/winrt/qwinrtcameravideorenderercontrol.cpp
@@ -426,4 +426,10 @@ void QWinRTCameraVideoRendererControl::decrementProbe()
--d->videoProbesCounter;
}
+void QWinRTCameraVideoRendererControl::resetSampleFormat()
+{
+ Q_D(QWinRTCameraVideoRendererControl);
+ d->cameraSampleformat = QVideoFrame::Format_User;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/winrt/qwinrtcameravideorenderercontrol.h b/src/plugins/winrt/qwinrtcameravideorenderercontrol.h
index eeda83d52..2f98e70f4 100644
--- a/src/plugins/winrt/qwinrtcameravideorenderercontrol.h
+++ b/src/plugins/winrt/qwinrtcameravideorenderercontrol.h
@@ -69,6 +69,9 @@ signals:
void bufferRequested();
void videoFrameProbed(const QVideoFrame &frame);
+public slots:
+ void resetSampleFormat();
+
private:
QScopedPointer<QWinRTCameraVideoRendererControlPrivate> d_ptr;
Q_DECLARE_PRIVATE(QWinRTCameraVideoRendererControl)