Segmentation fault when recreating the pipeline with gstreamer on Jetson Nano (using nvarguscamerasrc plugin), below is the debug log. nvcamerasrc used to work previously on old SDKs.
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 ()
could you please share more details, may I know which JetPack release you’re working with.
please also share the commands that you’re able to see the segmentation fault failure for review.
thanks
Hi Jerry,
I am using OpenCV, please find the code below. I am trying to create a pipeline and destroy it and again create a new one. In this process, I am experiencing the crash. Thanks for the kind reply.
#include <opencv2/opencv.hpp>
// #include <opencv2/videoio.hpp>
// #include <opencv2/highgui.hpp>
std::string gstreamer_pipeline (int capture_width, int capture_height, int display_width, int display_height, int framerate, int flip_method) {
return "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)" + std::to_string(capture_width) + ", height=(int)" +
std::to_string(capture_height) + ", format=(string)NV12, framerate=(fraction)" + std::to_string(framerate) +
"/1 ! nvvidconv flip-method=" + std::to_string(flip_method) + " ! video/x-raw, width=(int)" + std::to_string(display_width) + ", height=(int)" +
std::to_string(display_height) + ", format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink";
}
int main()
{
int capture_width = 1280 ;
int capture_height = 720 ;
int display_width = 1280 ;
int display_height = 720 ;
int framerate = 60 ;
int flip_method = 0 ;
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;
std::cout << "Hit ESC to exit" << "\n" ;
while(true)
{
if (!cap.read(img)) {
std::cout<<"Capture read error"<<std::endl;
break;
}
cv::imshow("CSI Camera",img);
int keycode = cv::waitKey(30) & 0xff ;
if (keycode == 27) break ;
}
cap.release();
cv::destroyAllWindows() ;
return 0;
}
there’s known issue that nvargus-daemon hang when calling pipeline stop with JetPack-4.2 / l4t-r32.1,
you might upgrade your working process to the latest JetPack release, i.e. JetPack-4.2.2 / l4t-32.2.1
BTW,
please also check similar discussion thread, Topic 1062196 for reference.
thanks
it’s a l4t-r32.1 known failure to terminate the pipeline.
since we had significant modifications to fix the issue, suggest upgrade to l4t-r32.2 if it’s possible.
thanks