Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.0 Beta1
-
None
-
9ceb1c083e4f6911ace1af3c9dfa6b4dd9036586
Description
Code from file qcamera.cpp:
void QCameraPrivate::setState(QCamera::State newState)
{
...
state = newState;
control->setState(state);
emit q->stateChanged(state);
}
Looks correct, but we don't check if control's state was really changed. It may work for some platforms but on android there is following code in qandroidcamerasession.cpp:
void QAndroidCameraSession::setState(QCamera::State state)
{
// If the application is inactive, the camera shouldn't be started. Save the desired state
// instead and it will be set when the application becomes active.
if (qApp->applicationState() != Qt::ApplicationActive)
...
I.e. there is possible situations where state will not be changed, but code above generates signal. As result there is no way to start something just after camera activated because wrong signal which prevent work code depending on camera and starting by this signal.
My fix which works for me:
void QCameraPrivate::setState(QCamera::State newState)
{
...
/*
state = newState;
control->setState(state);
emit q->stateChanged(state);
*/
control->setState(newState);
QCamera::State nState=control->state();
if(nState != state)
}
Attachments
For Gerrit Dashboard: QTBUG-35070 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
73362,1 | Use the backend to notify the QCamera state changes. | stable | qt/qtmultimedia | Status: MERGED | +2 | 0 |