Android: fix QMediaRecorder failing to start in some cases.

Because camera operations are performed in a dedicated thread, starting
a recorder was sometimes failing because the camera was not yet ready
(unlocking it was not done yet). Camera locking and unlocking are now
synchronous operations.

Change-Id: I92c3c2f3666b63e7451e4ee1ab89dcbc85ae6c24
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
Yoann Lopes
2014-03-13 16:35:01 +01:00
committed by The Qt Project
parent d204391cc1
commit c24c3b171f

View File

@@ -306,12 +306,16 @@ int JCamera::cameraId() const
void JCamera::lock() void JCamera::lock()
{ {
QMetaObject::invokeMethod(d, "callVoidMethod", Q_ARG(QByteArray, "lock")); QMetaObject::invokeMethod(d, "callVoidMethod",
Qt::BlockingQueuedConnection,
Q_ARG(QByteArray, "lock"));
} }
void JCamera::unlock() void JCamera::unlock()
{ {
QMetaObject::invokeMethod(d, "callVoidMethod", Q_ARG(QByteArray, "unlock")); QMetaObject::invokeMethod(d, "callVoidMethod",
Qt::BlockingQueuedConnection,
Q_ARG(QByteArray, "unlock"));
} }
void JCamera::reconnect() void JCamera::reconnect()