Please provide complete information as applicable to your setup.
• Hardware Platform (GPU) T4 • DeepStream Version 6.3 • TensorRT Version: 8.6 • NVIDIA GPU Driver Version (valid for GPU only): 525.85.12 • Issue Type( questions, new requirements, bugs): questions
I just learnt about the new nvstreammuxlink and its ability to dynamically add/remove sources
The muxer supports addition and deletion of sources at run time. When the muxer receives a buffer from a new source, it sends a GST_NVEVENT_PAD_ADDED event. When a muxer sink pad is removed, the muxer sends a GST_NVEVENT_PAD_DELETED event. Both events contain the source ID of the source being added or removed (see sources/includes/gst-nvevent.h ). Downstream elements can reconfigure when they receive these events. Additionally, the muxer also sends a GST_NVEVENT_STREAM_EOS to indicate EOS from the source.
But there is no explanation on it. Can someone give me an example on how it works?
I have currently implemented this by removing and adding the pad from the uridecodebin for the newly added/removed source. I check the source removal by polling its FPS. I am curious how the new-streammux can help me :)
You can add a Probe to the source-pad (output) of the nvstreammux plugin – or any other plugin pad downstream of the streammux – with a GstPadProbeType of GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM.
Your registered callback will be called with each event that flows over the source pad.
I have a C++ version of the callback that looks for streammux events as follows:
GstPadProbeReturn StreamEventPadProbeEventHandler::HandlePadData(
GstPadProbeInfo* pInfo)
{
LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_padHandlerMutex);
if (!m_isEnabled)
{
return GST_PAD_PROBE_OK;
}
uint streamEvent(0);
uint streamId(0);
GstEvent *event = (GstEvent*)pInfo->data;
if ((uint)GST_EVENT_TYPE(event) == (uint)GST_NVEVENT_PAD_ADDED)
{
gst_nvevent_parse_pad_added(event, &streamId);
LOG_INFO("GST_NVEVENT_PAD_ADDED received for stream-id="
<< streamId);
streamEvent = DSL_PPH_EVENT_STREAM_ADDED;
}
else if ((uint)GST_EVENT_TYPE(event) == (uint)GST_NVEVENT_PAD_DELETED)
{
gst_nvevent_parse_pad_deleted(event, &streamId);
LOG_INFO("GST_NVEVENT_PAD_DELETED received for stream-id="
<< streamId);
streamEvent = DSL_PPH_EVENT_STREAM_DELETED;
}
else if ((uint)GST_EVENT_TYPE(event) == (uint)GST_NVEVENT_STREAM_EOS)
{
gst_nvevent_parse_stream_eos(event, &streamId);
LOG_INFO("DSL_PPH_EVENT_STREAM_ENDED received for stream-id="
<< streamId);
streamEvent = DSL_PPH_EVENT_STREAM_ENDED;
}
// It's not a stream event so bail out.
else
{
return GST_PAD_PROBE_OK;
}
// It is a stream event so call the client handler.
try
{
return (GstPadProbeReturn)m_clientHandler(streamEvent,
streamId, m_clientData);
}
catch(...)
{
LOG_ERROR("Stream Event Pad ProbeHandler '" << GetName()
<< "' threw an exception calling client listener");
return GST_PAD_PROBE_REMOVE;
}
}
Note that the GST_EVENT_TYPE and NVIDIA’s GstNvEventType define different enum types so you will need to cast on comparison.