• Jetson Nano
• DeepStream 5.0 (GA)
• JetPack 4.4
• TensorRT 7.1.3.0
• bug
I am trying to introduce functionality of looping over static video files, under deepstream, using python binding api.
This functionality is doing basically:
- creating bin(s) with filesrc->qtdemux->queue->h264parse->nvv4l2decoder
- this bin is then connected to nvstreammux
- there is another processing in pipeline after nvstreammux
For restart i am adding simple probe to nvv4l2decoder sink
sink_pad = nvv4l2decoder.get_static_pad("sink")
if not sink_pad:
LOG.error("Unable to get sink pad on nvv4l2decoder")
return False
else:
sink_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM | Gst.PadProbeType.EVENT_FLUSH,
self.restart_stream_probe,
None)
and restart is done in the following way
def restart_stream_probe(self, pad, info, c_element):
event = info.get_event()
if event is not None and event.type == Gst.EventType.EOS:
LOG.debug(f'EOS on {self.input_id}')
GLib.timeout_add_seconds(1, self.rewind_source, None)
return Gst.PadProbeReturn.DROP
elif event.type == Gst.EventType.FLUSH_START or event.type == Gst.EventType.FLUSH_STOP:
return Gst.PadProbeReturn.DROP
return Gst.PadProbeReturn.OK
def rewind_source(self, data):
LOG.debug(f'entering seek on {self.input_id}')
self.element.set_state(Gst.State.NULL)
self.filesrc.seek(1.0,
Gst.Format.TIME,
Gst.SeekFlags.FLUSH,
Gst.SeekType.SET, 0,
Gst.SeekType.NONE, 0)
self.element.set_state(Gst.State.PLAYING)
return False
I observe that, whole app framerate goes continuously down, when app is doing this kind of restart. With live streams like rtsp there is no problem.
My first version was to use uridecodebin (as is used in provided deepstream samples) but result was even worse. Uridecodebin was recreating whole child pads, so my assumption was it is leak in uridecodebin. Thats why i rewrited this fnc, and during seek, there is no creation procedure.
When videofile is quite short (20s for example) problem shows more quickly.
Jetson has “standard” perf improvements
- jetson_clocks
- nvpmodel -m 0
And also nvv4l2decoder has
- bufapi-version = 1
- enable-max-performance=1
- num-extra-surfaces=8 (this helps a lot)
So question is, how to do correct restart on EOS? Is there different way ? Or there is mem/performance bug, when stream is restarted in this way?
Similar functionality is in deepstream_perf_demo.cpp, but for simple “rewind” without timestamp progression i dont need this accumulated_base calculations.
Slowdown progress is in the following observation