AnsweredAssumed Answered

cannot reopen camera twice

Question asked by Toming LIU on Apr 5, 2016
Latest reply on May 18, 2016 by Toming LIU

Dear All

 

I am facing a camera problem when using QT5 GUI libraries, pls see my implementation

 

int Q_DECL_EXPORT txHalInit()
{

    if(!camera) {

        camera = new QCamera(QCameraInfo::defaultCamera());

        if(!camera) return -1;

        cameraViewfinder = new QCameraViewfinder();

        if(!cameraViewfinder) {

            delete camera; return -1;

        }

int Q_DECL_EXPORT txToggleVideo(void)
{

    if(camera) {

        if(isVideoOn == false)

        {

            if(camera->state() == QCamera::UnloadedState) {

                cameraViewfinder->show();

                camera->setViewfinder(cameraViewfinder);

                camera->start();

            }

            cameraViewfinder->setWindowOpacity(1.0);

            isVideoOn = true; return 1;

        }

        else

        {

            cameraViewfinder->hide();

            //cameraViewfinder->setWindowOpacity(0.0);

            camera->stop();camera->unlock(); camera->unload();

            isVideoOn = false; return 0;

        }

    }

    return -1;

}


}

 

When I try to toggle camera video on and off twice, i get below error, The camera will stop capture video when getting below error

 

void CameraBinSession::setState(QCamera::State) QCamera::ActiveState
GstElement* CameraBinSession::buildCameraSource()
bool CameraBinSession::setupCameraBin() Viewfinder changed, reconfigure.
Source caps: video/x-raw, format=(string){ I420, NV12, YUY2, UYVY }, width=(int)720, height=(int)480, framerate=(fraction)30/1, interlace-mode=(string)interleaved
Supported resolutions: video/x-raw, width=(int)720, height=(int)480
(QSize(720, 480))
Supported rates: video/x-raw, framerate=(fraction)30/1
(QPair(30,1))
====== MP3ENC: 4.0.9 build on Mar 25 2016 16:53:25. ======


(halTests:833): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed


(halTests:833): GStreamer-CRITICAL **: gst_object_unref: assertion 'object != NULL' failed
>>>>> fps=0.752219:
GstElement* CameraBinSession::buildCameraSource()
Source caps: video/x-raw, format=(string){ I420, NV12, YUY2, UYVY }, width=(int)720, height=(int)480, framerate=(fraction)30/1, interlace-mode=(string)interleaved
Supported resolutions: video/x-raw, width=(int)720, height=(int)480
(QSize(720, 480))
Supported rates: video/x-raw, framerate=(fraction)30/1
(QPair(30,1))
====== MP3ENC: 4.0.9 build on Mar 25 2016 16:53:25. ======
true
"state changed: old: GST_STATE_NULL  new: GST_STATE_READY  pending: GST_STATE_VOID_PENDING"
[INFO]  Product Info: i.MX6Q/D/S
====== VPUENC: 4.0.9 build on Mar 25 2016 16:53:17. ======
        wrapper: 1.0.65 (VPUWRAPPER_ARM_LINUX Build on Mar 25 2016 16:51:00)
        vpulib: 5.4.33
        firmware: 3.1.1.46072
[INFO]  Product Info: i.MX6Q/D/S
====== VPUENC: 4.0.9 build on Mar 25 2016 16:53:17. ======
        wrapper: 1.0.65 (VPUWRAPPER_ARM_LINUX Build on Mar 25 2016 16:51:00)
        vpulib: 5.4.33
        firmware: 3.1.1.46072
"state changed: old: GST_STATE_READY  new: GST_STATE_PAUSED  pending: GST_STATE_PLAYING"
CameraBin error: "Internal data flow error."
CameraBin error: "Internal data flow error."

 

who can kindly give me some advice to solve this issue?? appreciate

 

Regards

Toming

Outcomes