Can we monitor gstreamer pipeline opened by OPENCV through the gstreamer code?
I am opening an gstreamer pipeline with opencv. Now,as long as data is coming everything works fine. But, when for any reason if data stops coming, then pipeline is stucked and because of that opencv is stucked. Below is the code which i am using:
#define UDP_URL "udpsrc port=15004 buffer-size=5000000 ! watchdog timeout=1000 ! tsdemux latency=0 ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! video/x-raw,format=BGRA,width=1280,height=960 ! appsink max-buffers=2"
int main()
{
cv::VideoCapture video;
cv::Mat frame;
video.open(Stream_URL, cv::CAP_GSTREAMER);
if (!video.isOpened()) {
printf("Error in opening.\n");
return -1;
}
while(1) {
if(video.read(frame))
{
// some operation on frame.
}
else
break;
}
video.release();
return 0;
}
In above code when there is no data on port 15004, then video.read(frame) function gets stucked, especially the v4l2h264dec decoder. I think this decode is getting stucked. And when data again starts coming still it is stucked on the same function. During gstreamer debugging I got "gstreamer pipeline is in halt state", even though I can that the data is coming on the port 15004 with the help of tcpdump command. I am thinking of using gstreamer code to monitor the pipeline, but I don't how do I monitor. Also i am using IMX8QM board, the gstreamer version is 1.0 and opencv version is 4.6.0.
I did not try any code for monitoring, because I do not know how we can access the opencv backend, from the source file.
Comments
Post a Comment