In tegra_multimedia_api/samples/13_multi_camera NvError_IoctlFailed error

Hi,

I was try to get data from multi_camera using OpenCV.

So i was modify 13_multi_camera cpp code in samples folder like below code.


    int fd = iNativeBuffer->createNvBuffer(iEglOutputStreams[i]->getResolution(), NvBufferColorFormat_ABGR32, NvBufferLayout_Pitch);
    void *pdata = NULL;

    NvBufferMemMap(fd, 0, NvBufferMem_Read, &pdata);
    NvBufferMemSyncForCpu(fd, 0, &pdata);

    imgbuf[i] = cv::Mat(iEglOutputStreams[i]->getResolution().height(),
			iEglOutputStreams[i]->getResolution().width(),
			CV_8UC4, pdata);

    cvtColor(imgbuf[i], display_img[i], CV_RGBA2BGR);

But when i run the code, first the code run without error, then few seconds later, the below error occur.


Argus Version: 0.97.3 (multi-process)
CONSUMER: Waiting until producer is connected…
CONSUMER: Producer has connected; continuing.
CONSUMER: Waiting until producer is connected…
CONSUMER: Producer has connected; continuing.
CONSUMER: Waiting until producer is connected…
CONSUMER: Producer has connected; continuing.
CONSUMER: Waiting until producer is connected…
CONSUMER: Producer has connected; continuing.
Gtk-Message: 19:12:38.340: Failed to load module “canberra-gtk-module”
NvRmChannelSubmit: NvError_IoctlFailed with error code 22
NvRmPrivFlush: NvRmChannelSubmit failed (err = 196623, SyncPointIdx = 74, SyncPointValue = 0)
NvRmChannelSubmit: NvError_IoctlFailed with error code 22

I think this is because of the memory.
But i don’t know how can i fix it.

(i added my code link https://github.com/localryu/multi_cam_xavier/blob/master/main.cpp)

Hi,
You can see m_dmabufs[i] is reused by calling copyToNvBuffer(). The issue should be that fd is allocated continually.

int fd = iNativeBuffer->createNvBuffer(iEglOutputStreams[i]->getResolution(), NvBufferColorFormat_ABGR32, NvBufferLayout_Pitch);

You may call NvBufferDestroy(). Or make it reuse-able by calling copyToNvBuffer().

@DaneLLL Thanks a lot.i solved the problems.

And I am trying to run this code in ROS.
so i am making the ROS package for this code.
but i have an error in make process.

the error is

CMakeFiles/multi_camera.dir/src/multi_cam.cpp.o: In function `ArgusSamples::ConsumerThread::~ConsumerThread()':
multi_cam.cpp:(.text+0x664): undefined reference to `NvBufferDestroy'
multi_cam.cpp:(.text+0x6c8): undefined reference to `NvBufferDestroy'
multi_cam.cpp:(.text+0x71c): undefined reference to `ArgusSamples::Thread::~Thread()'
CMakeFiles/multi_camera.dir/src/multi_cam.cpp.o: In function `ArgusSamples::ConsumerThread::threadInitialize()':
multi_cam.cpp:(.text+0x7fc): undefined reference to `EGLStream::FrameConsumer::create(Argus::OutputStream*, Argus::Status*)'
CMakeFiles/multi_camera.dir/src/multi_cam.cpp.o: In function `ArgusSamples::ConsumerThread::threadExecute()':
multi_cam.cpp:(.text+0xd3c): undefined reference to `NvBufferMemMap'
multi_cam.cpp:(.text+0xd50): undefined reference to `NvBufferMemSyncForCpu'
multi_cam.cpp:(.text+0xeb0): undefined reference to `NvBufferMemUnMap'
multi_cam.cpp:(.text+0xeb8): undefined reference to `NvBufferDestroy'
multi_cam.cpp:(.text+0x10a8): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
multi_cam.cpp:(.text+0x10e4): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
multi_cam.cpp:(.text+0x1120): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
multi_cam.cpp:(.text+0x115c): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
multi_cam.cpp:(.text+0x1174): undefined reference to `cv::waitKey(int)'
CMakeFiles/multi_camera.dir/src/multi_cam.cpp.o: In function `ArgusSamples::execute()':
multi_cam.cpp:(.text+0x14ac): undefined reference to `Argus::CameraProvider::create(Argus::Status*)'
multi_cam.cpp:(.text+0x185c): undefined reference to `ArgusSamples::Thread::initialize()'
multi_cam.cpp:(.text+0x1908): undefined reference to `ArgusSamples::Thread::waitRunning(unsigned int)'
CMakeFiles/multi_camera.dir/src/multi_cam.cpp.o: In function `ArgusSamples::ConsumerThread::ConsumerThread(std::vector<Argus::OutputStream*, std::allocator<Argus::OutputStream*> >&)':
multi_cam.cpp:(.text._ZN12ArgusSamples14ConsumerThreadC2ERSt6vectorIPN5Argus12OutputStreamESaIS4_EE[_ZN12ArgusSamples14ConsumerThreadC5ERSt6vectorIPN5Argus12OutputStreamESaIS4_EE]+0x18): undefined reference to `ArgusSamples::Thread::Thread()'

I was added nvbuf_utils.h but i can’t find the source code which have the function’s definitions.

Hi,
Looks like certain headers/libs are not included/linked. You may refer to original Makefiles

/usr/src/tegra_multimedia_api/samples/Rules.mk
/usr/src/tegra_multimedia_api/samples/13_multi_camera/Makefile