AnsweredAssumed Answered

i.MX6_IPU_TVIN_Application_Notes patch cause problem in QT application

Question asked by Ali Sarlak on Oct 3, 2019
Latest reply on Oct 8, 2019 by Qiang Li - Mpu Se

According to “i.MX6_IPU_TVIN_Application_Notes” document I changed Linux kernel (4.1.36) in order to have capability of resync the video stream when vertical sync is lost but some problems appeared. I run declarative-camera which is one of QT examples, also I set environment variables  QT_GSTREAMER_CAMERABIN_VIDEOSRC to imxv4l2src and QT_GSTREAMER_CAMERABIN_VIDEOSINK to imxipuvideosink the below errors generated when video vsync lost by a noise or unplug and plug the video connector:

 

 ** CRITICAL **: gst_audio_format_from_string: assertion 'format != NULL' failed

ERROR: v4l2 capture: slave not found!

Unable to query the parameter info: QCameraImageProcessingControl::WhiteBalancePreset : "Invalid argument"

Unable to query the parameter info: QCameraImageProcessingControl::ColorTemperature : "Invalid argument"

Unable to query the parameter info: QCameraImageProcessingControl::ContrastAdjustment : "Invalid argument"

Unable to query the parameter info: QCameraImageProcessingControl::SaturationAdjustment : "Invalid argument"

Unable to query the parameter info: QCameraImageProcessingControl::BrightnessAdjustment : "Invalid argument"

Unable to query the parameter info: QCameraImageProcessingControl::SharpeningAdjustment : "Invalid argument"

ERROR: v4l2 capture: unsupported ioctrl!

 

(Chopper:173): GStreamer-CRITICAL **: Registering meta implementation 'GstImxV4l2Meta' without init function

ERROR: v4l2 capture: mxc_streamon buffer need ping pong at least two buffers

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

CameraBin error: "Internal data stream error."

ERROR: v4l2 capture: unsupported ioctrl!

 

The main problem is “mxc_streamon buffer need ping pong at least two buffers” and the video freeze on screen but the QT application is alive and not crashed.

Instead of running QT declarative-camera If I use gstreamer command, like below:

gst-launch-1.0 imxv4l2videosrc ! imxipuvideosink

it works fine, even if I unplug and plug the video connector.

 

When I investigated this problem more carefully, I found that the problem comes from mxc_reset_stream function, list_for_each_entry(frame, &tmp_queue, queue) cause infinite loop and one of IMX6Q’s CPU cores reached to 100% which is natural due to infinite loop, instead when gstreamer used it just iterate 5 times or so and as I mentioned before it works fine.

So, I changed list_for_each_entry like below:

 

    int index=0;

                struct list_head *start = &tmp_queue;

                struct list_head *ptr = start;

                do

                {

                                frame = list_entry(ptr, struct mxc_v4l_frame, queue);

                                frame->buffer.flags |= V4L2_BUF_FLAG_QUEUED;

                                ptr = ptr->next;

                                index++;

                }while(ptr!= start && ptr!=NULL && ptr!= (ptr->next) );

 

After this modification infinite loop gone but after 3 times of vsync lost “cam->working_q” became 1 hence

mxc_streamon buffer need ping pong at least two buffers happen.

 

In case of using gstreamer, “cam->working_q” never be less than 2 and it works just fine.

 

Without this patch QT works fine like gstreamer but I had video scrolling.

 

Extra Info:

Linux : 4.1.36

QT: 5.9.2 or 5.11.1

 

 

I appreciate any help or clue to solve this problem

 

Yours,

 

Outcomes