delaying an RTP stream by some exact value

I am receiving a h264 RTP stream in gstreamer pipeline C . I want to change the PTS of the stream such that the stream should be delayed at receiver by some precise amount of time from the time which it was created at sender. i am currency directly adding the amount of delay i want in the already present PTS . but i am getting some extra delay in the range of 300ms to 900ms. ptimestramp = 5 seconds (5 sec of extra delay)
i am getting the delay in range of 5.300 ms to 8.900 ms

     GST_BUFFER_PTS (buffer)+=ptimestamp;

how can i get rid of this and get exact delay

architecture is something like this

    browser-sender-client --->media-server---> Gstreamer-C-pipeline ---> media-server ---> browser-receiver-client

i want the stream to be played at browser-receiver-client by some precise amount of delay from the time it was created at sender side.

How are you measuring the delay?

Every step in your pipeline is going to add some latency. My guess would be that the extra 300-900ms is the latency is the time it takes to go from sender → mediasoup → gstreamer → mediasoup → receiver.

thanks for you reply,
i am sending my screen as a video stream a clock is there on the screen min:sec:ms and i am receiving back the same stream on same client and then i take the screenshot of the screen and measure the difference which looks something like this


as you suggested that extra delay is due to time it takes for the stream to reach from sender to receiver how can i calculate and reduce this extra delay can i reduce this delay by calculating the round trip time. and subtracting it from the delay i want .

on browser side there is no api to delay the received video stream.
can i use gstreamer wtih libmediasoupclient and add the delay on client side. does libmediasoupclient allows to send
rtp stream to gstreamer .