Android: fix QMediaRecorder failing to start in some cases.
authorYoann Lopes <yoann.lopes@digia.com>
Thu, 13 Mar 2014 15:35:01 +0000 (16:35 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 17 Mar 2014 13:46:53 +0000 (14:46 +0100)
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>
src/plugins/android/src/wrappers/jcamera.cpp

index 23f3e14..50a65a7 100644 (file)
@@ -306,12 +306,16 @@ int JCamera::cameraId() const
 
 void JCamera::lock()
 {
-    QMetaObject::invokeMethod(d, "callVoidMethod", Q_ARG(QByteArray, "lock"));
+    QMetaObject::invokeMethod(d, "callVoidMethod",
+                              Qt::BlockingQueuedConnection,
+                              Q_ARG(QByteArray, "lock"));
 }
 
 void JCamera::unlock()
 {
-    QMetaObject::invokeMethod(d, "callVoidMethod", Q_ARG(QByteArray, "unlock"));
+    QMetaObject::invokeMethod(d, "callVoidMethod",
+                              Qt::BlockingQueuedConnection,
+                              Q_ARG(QByteArray, "unlock"));
 }
 
 void JCamera::reconnect()