Gstreamer getting wrong pts after seeking.

Hi,
I am getting wrong pts after performing two consecutive seeks with some wait in between.

I am using the below pipeline:

“filesrc location=input.avi ! avidemux ! video/x-h264 ! queue ! h264parse !
omxh264dec ! nvvidconv ! video/x-raw, format=GRAY8 ! appsink name=sinkDec
sync=false max-buffers=50 drop=false”

What I am observing is that the frames I pull from appsink after performing two consecutive seeks with some wait in between have incorrect pts.
One thing I notice is that this happens only if the first seek I performed is closer to the end of the file.

I have also validated the above problem from the logs.
When this problem occurs, the videodecoder show below logs:

videodecoder gstvideodecoder.c:2737:gst_video_decoder_prepare_finish_frame:
decreasing timestamp (0:01:18.000000000 < 0:01:19.960000000)
videodecoder gstvideodecoder.c:2700:gst_video_decoder_prepare_finish_frame:
invalidating PTS

The sample code can be found here :
https://www.dropbox.com/s/sgwvbophr3lxt7r/testPts.cpp?dl=0

The sample video can be found here :
https://www.dropbox.com/s/br9h6o6t6e9o1n3/input.avi?dl=0

Can someone explain me why I am getting wrong pts?

Hi rastogishubham20,
I think the issue is in avidemux. We have verified it with MP4 and it works fine:
https://devtalk.nvidia.com/default/topic/1031460/jetson-tx1/gstreamer-pipeline-freezes-while-seeking-because-of-omxh264dec-element-/post/5248489/#5248489