return;
QSize viewportSize = m_session->camera()->previewSize();
+
+ if (!viewportSize.isValid())
+ return;
+
QSizeF focusSize(50.f / viewportSize.width(), 50.f / viewportSize.height());
float x = qBound(qreal(0),
m_actualFocusPoint.x() - (focusSize.width() / 2),
QSize viewfinderResolution = m_camera->previewSize();
const qreal aspectRatio = qreal(captureSize.width()) / qreal(captureSize.height());
- if (qFuzzyCompare(aspectRatio, qreal(viewfinderResolution.width()) / qreal(viewfinderResolution.height())))
+ if (viewfinderResolution.isValid() &&
+ qFuzzyCompare(aspectRatio,
+ qreal(viewfinderResolution.width()) / viewfinderResolution.height())) {
return;
+ }
QList<QSize> previewSizes = m_camera->getSupportedPreviewSizes();
for (int i = previewSizes.count() - 1; i >= 0; --i) {
JMultimediaUtils::enableOrientationListener(false);
m_camera->stopPreview();
+ m_camera->setPreviewSize(QSize());
if (m_videoOutput)
m_videoOutput->stop();
m_previewStarted = false;
m_previewSize = size;
- m_parameters.callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height());
- applyParameters();
+ if (m_previewSize.isValid()) {
+ m_parameters.callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height());
+ applyParameters();
+ }
emit previewSizeChanged();
}