Restarting the pipeline with narguscamerasrc immediately is causing pipeline halt, I set the pipelin...

can any one please help me out on how to restart a pipeline with nvarguscamerasrc i.e making the pipeline to NULL state and then making it to PLAYING state. I am trying to create a gstreamer application to access onboard camera of NVIDIA Jetson TX2.

Thanks in advance.

Could you destroy and recreate the pipeline as solution?

I am making the pipeline to NULL and doing unref for the pipeline element (GstElement) but still I am unable to get it working. Can you please explain what do you mean by destroying?.

After doing some debugging the crash is happening due the mutex lock inside the libgstnvarguscamerasrc.so. Is it a bug in the nvarguscamerasrc?. I pasted the debug log below.

0x0000007fb79ce6f0 in __GI___pthread_mutex_lock (mutex=0x58) at pthread_mutex_lock.c:65
#1 0x0000007fb72ba098 in () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so
#2 0x0000007fb72b8b60 in () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so
#3 0x0000007fb7d5498c in () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#4 0x0000007fb342e598 in ()

This can even be reproduced with OpenCV,

  1. I opened the camera
  2. closed it (cap.release())
  3. opned again

I experienced a crash.

GST_ARGUS: 2592 x 1458 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 22000, max 358733000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 2
Output Stream W = 1280 H = 720
seconds to Run = 0
Frame Rate = 120.000005
Segmentation fault (core dumped)

Below is the code snippet.

[i]
std::string pipeline = gstreamer_pipeline(capture_width,
capture_height,
display_width,
display_height,
framerate,
flip_method);
std::cout << “Using pipeline: \n\t” << pipeline << “\n”;

/* Create a VideoCapture element */
cv::VideoCapture cap1(pipeline, cv::CAP_GSTREAMER);;
if(!cap1.isOpened()) {
std::cout<<“Failed to open camera.”<<std::endl;
return (-1);
}
cap1.release(); // released the first capture element

/* Create a another VideoCapture element */
cv::VideoCapture  cap(pipeline, cv::CAP_GSTREAMER);; 
if(!cap.isOpened()) {
std::cout<<"Failed to open camera."<<std::endl;
return (-1);
}
if(!cap.isOpened()) {
std::cout<<"Failed to open camera."<<std::endl;
return (-1);
}
cv::namedWindow("CSI Camera", cv::WINDOW_AUTOSIZE);
cv::Mat img;[/i]

what I assume here is that when you release the caps then the camera should be free to be used in another pipeline of the same program. But I am unable to get it working. Can anyone please help me to get over with it?

Did you use r32.2?
There’s some fix for nvargus-daemon freeze/hang on pipeline stop

Hi, I am using L4T R32.1. Is there a path available for this version.?

Have a try the fixed from below link

https://devtalk.nvidia.com/default/topic/1062196/jetson-tx2/nvargus-daemon-freeze-hang-on-pipeline-stop-on-r32-1/post/5388424/#5388424

Working well, no hang or halt issues. I appreciate for the quick turnaround.

Thanks,
Ram