Webcam Input Lag

On Jetson Xavier, I have made a custom app, with this pipeline:-
v4l2src -> …YUY2… -> videoconvert -> nvvideoconvert ->nvinfer1->nvinfer2->tiler->nvvideoconvert->nvosd->Tee

Then Tee->nvoverlaysink

Tee->queue->NVDS_ELEM_VIDEO_CONV->NVDS_ELEM_ENC_H264_HW->h264parse->NVDS_ELEM_MUX_MP4->NVDS_ELEM_SINK_FILE

I get a good enough fps but there seems to be a constant lag. I have tried disabling one of the nvinfers but I see no improvement.

I tried the advice from the troubleshooting guide(https://docs.nvidia.com/metropolis/deepstream/plugin-manual/index.html#page/DeepStream%20Plugins%20Development%20Guide/deepstream_plugin_troubleshooting.html) but still there is lag.

Can you provide platform and version information?
Hardware Platform (Jetson / GPU) :
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)

Jetson Xavier NX
DS 5
JetPack 4.4

I somewhat mitigated the issue by adding a leaky queue in front of nvstreammux. It seems that one of the nvinfers was indeed the issue and the latency goes away totally when I increase the interval. YoloV3 might be too heavy for Xavier NX judging by some forum posts.