Respond to 'nvdsvideotemplate' failing to load

• Hardware Platform: Both Jetson and dGPU
• DeepStream Version: 6.0
• JetPack Version (valid for Jetson only): 4.6 (L4T 32.6.1)
• TensorRT Version: 8.0.1
• NVIDIA GPU Driver Version (valid for GPU only): 470.63
• Issue Type: Question

Hello, I have a question on how to correctly react when ‘nvdsvideotemplate’ fails to load.

Consider the following scenario:

We have a c++ library called libdummy.so, which serves as the backed for the ‘nvdsvideotemplate’ plugin. Then we instantiate the element in python:

video_template: Gst.Element = Gst.ElementFactory.make('nvdsvideotemplate',)
video_template.set_property('customlib-name', './libdummy.so')

Now, consider the situation when an arbitrary symbol from this library is missing (due to incorrect compilation or some dependent library is not present on the machine where Deepstream is being ran).

This causes the following error to be printed into the console, which is expected:

./libdummy.so: undefined symbol: _Z6dummy_ifPv

However the calling python code does not crash, nor does raise an exception. The gst-pipeline containing this element can be ran (set to PLAYING state), however the library is not loaded, causing mandatory operations not being executed when processing the buffers.

Is there a ways to check for this behaviour when creating the element in python? I.e, is there a way to make sure when creating ‘nvdsvideotemplate’ element, that the customlib is loaded correctly and no symbol is missing before running the gstreamer pipeline?

Thank you,
Simon

nvdsvideotemplate is opensource, you can add thirdparty lib checking code. here is the path: opt\nvidia\deepstream\deepstream\sources\gst-plugins\gst-nvdsvideotemplate\customlib_impl\customlib_impl.cpp

I have found the following code, which opens the shared library. I understand that by modifying this, i can achieve the behaviour i am looking for.

    IDSCustomLibrary *CreateCustomAlgoCtx(std::string libName)
    {
        m_libName.assign(libName);

        m_libHandle = dlopen(m_libName.c_str(), RTLD_NOW);
        if (m_libHandle)
        {
            std::cout << "Library Opened Successfully" << std::endl;

            m_CreateAlgoCtx = dlsym_ptr<IDSCustomLibrary*()>(m_libHandle, "CreateCustomAlgoCtx");
            if (!m_CreateAlgoCtx)
            {
                throw std::runtime_error("createCustomAlgoCtx function not found in library");
            }
        }
        else
        {
            throw std::runtime_error(dlerror());
        }

        return m_CreateAlgoCtx();
    }
1 Like

Glad to know you fixed it, thanks for the update! If need further support, please open a new one. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.