Csicam with nvosd

I modified the deepstream_test1 in the deepstream 5.0 samples to have as an input the csi camera. It works but the video is very very slow (about 1 FPS). It looks like frames are being processed normally but only the nvosd is being slow.
Here is my pipeline:
nvarguscamera -> capsfilter ->nvstreammux -> nvinfer ->nvvidconv ->nvosd -> nvegltransform -> nveglglessink

Do you know why it is being so slow?

I am still having this problem. Is there a sample maybe I could take a look at? Or is there an explanation for this slow on screen display?

Can you add queues between every two elements after nvstreammux to see if improvements?

Solution in here: