Im receiving the following error when trying to launch two instances of Gstreamer:
NvxBaseWorkerFunction[2575] comp OMX.Nvidia.std.iv_renderer.overlay.yuv420 Error -2147479552
nvdc: open: Too many open files
nvdc: failed to open '/dev/fb0'.
NvxBaseWorkerFunction[2575] comp OMX.Nvidia.std.iv_renderer.overlay.yuv420 Error -2147479552
nvdc: open: Too many open files
nvdc: failed to open '/dev/tegra_dc_1'.
NvxBaseWorkerFunction[2575] comp OMX.Nvidia.std.iv_renderer.overlay.yuv420 Error -2147479552
nvdc: open: Too many open files
nvdc: failed to open '/dev/tegra_dc_1'
The pipeline is very simple:
std::ostringstream launch_stream;
launch_stream <<
"nvarguscamerasrc sensor-id="<<argus_device_idx_offset <<
" sensor-mode=1 do-timestamp=true wbmode=1 aelock=0 exposuretimerange='11000 6954000' ee-mode=0 gainrange='1 4' ispdigitalgainrange='1 1' aeantibanding=3 tnr-mode=2 tnr-strength=-0.2 ! " <<
"video/x-raw(memory:NVMM),width=" << w << ",height=" << h << ",framerate=" << frame_rate << "/1,format=NV12 ! " <<
"nvvidconv interpolation-method=4 ! video/x-raw(memory:NVMM), format=NV12, width=960 height=540 ! " <<
"nvvidconv name=myconv ! " <<
"video/x-raw(memory:NVMM),format=RGBA ! " <<
"nvoverlaysink ";
The custom nvvidconv is just getting the frame to perfrom opencv operations:
static GstPadProbeReturn conv_src_pad_buffer_probe(
GstPad * pad, GstPadProbeInfo * info,
gpointer u_data)
{
JUtilsCameraDriver * jcd_ptr = reinterpret_cast<JUtilsCameraDriver *>(u_data);
GstBuffer * buffer = (GstBuffer *) info->data;
GstMapInfo map = {0};
int dmabuf_fd = 0;
gst_buffer_map(buffer, &map, GST_MAP_READ);
ExtractFdFromNvBuffer((void *)map.data, &dmabuf_fd);
//CUDA postprocess
{
EGLImageKHR egl_image;
egl_image = NvEGLImageFromFd(egl_display, dmabuf_fd);
CUresult status;
CUeglFrame eglFrame;
CUgraphicsResource pResource = NULL;
cudaFree(0);
status = cuGraphicsEGLRegisterImage(
&pResource,
egl_image,
CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
if (status != CUDA_SUCCESS) {
printf("cuGraphicsEGLRegisterImage failed: %d \n", status);
}
status = cuGraphicsResourceGetMappedEglFrame(&eglFrame, pResource, 0, 0);
status = cuCtxSynchronize();
if (create_filter) {
filter = cv::cuda::createSobelFilter(CV_8UC4, CV_8UC4, 1, 0, 3, 1, cv::BORDER_DEFAULT);
//filter = cv::cuda::createGaussianFilter(CV_8UC4, CV_8UC4, cv::Size(31,31), 0, 0, cv::BORDER_DEFAULT);
}
cv::cuda::GpuMat d_mat_RGBA(h, w, CV_8UC4, eglFrame.frame.pPitch[0]); //RGBA
/* Get BGR */
cv::cuda::GpuMat d_mat_BGR;
cv::cuda::cvtColor(d_mat_RGBA, d_mat_BGR, cv::COLOR_RGBA2BGR, 3);
cv::Mat myImageBGR;
d_mat_BGR.download(myImageBGR);
++frame_num;
status = cuCtxSynchronize();
status = cuGraphicsUnregisterResource(pResource);
NvDestroyEGLImage(egl_display, egl_image);
}
gst_buffer_unmap(buffer, &map);
return GST_PAD_PROBE_OK;
}
If a launch more than one instance of the code, there errors appear and the 2nd instance crashes.
What is this error and what could be causing it?