FFmpeg timestamps after seeking are incorrect

Hi.
Some videos packets do not contain pts, when trying to seek these videos while using h264_cuvid decoder and decode from the new position the decoder produces frames with incorrect timestamp. the frame content seems to be correct however get_best_effort_timestamp returns 0 for the first frame after seeking instead of the correct frame timestamp. it seems to be related to pkt_dts not being set by cuvid decoder since best_effort_timestamp is determined using pkt_dts.

ffmpeg -hide_banner -ss 00:01:00 -c:v h264_cuvid -i D:\Movies\clip.avi -vf showinfo -f null -
Input #0, avi, from ‘D:\Movies\clip.avi’:
Duration: 01:59:50.28, start: 0.000000, bitrate: 1079 kb/s
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1024x768 [SAR 1:1 DAR 4:3], 1075 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_0 @ 000001D4E72F1DA0] config in time_base: 1/25, frame_rate: 25/1
[Parsed_showinfo_0 @ 000001D4E72F1DA0] config out time_base: 0/0, frame_rate: 0/0
[Parsed_showinfo_0 @ 000001D4E72F1DA0] n: 0 pts: 0 pts_time:0 pos: -1 fmt:nv12 sar:1/1 s:1024x768 i:P iskey:1 type:? checksum:BAB8EF1A plane_checksum:[A3FC1C2A 2F62D2F0] mean:[134 128] stdev:[50.3 5.8]
Output #0, null, to ‘pipe:’:
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: wrapped_avframe, nv12, 1024x768 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.89.100 wrapped_avframe
[Parsed_showinfo_0 @ 000001D4E72F1DA0] n: 1 pts: 1 pts_time:0.04 pos: -1 fmt:nv12 sar:1/1 s:1024x768 i:P iskey:1 type:? checksum:C2786A5D plane_checksum:[61D28281 7C9AE7CD] mean:[134 128] stdev:[50.1 5.7]
[Parsed_showinfo_0 @ 000001D4E72F1DA0] n: 2 pts: 2 pts_time:0.08 pos: -1 fmt:nv12 sar:1/1 s:1024x768 i:P iskey:1 type:? checksum:E0E1ACE0 plane_checksum:[057DBB43 0207F18E] mean:[134 128] stdev:[50.1 5.7]

ffmpeg -hide_banner -ss 00:01:00 -i D:\Movies\clip.avi -vf showinfo -f null -
Input #0, avi, from ‘D:\Movies\clip.avi’:
Duration: 01:59:50.28, start: 0.000000, bitrate: 1079 kb/s
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1024x768 [SAR 1:1 DAR 4:3], 1075 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_0 @ 0000022DB64CAFE0] config in time_base: 1/25, frame_rate: 25/1
[Parsed_showinfo_0 @ 0000022DB64CAFE0] config out time_base: 0/0, frame_rate: 0/0
Output #0, null, to ‘pipe:’:
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: wrapped_avframe, yuv420p, 1024x768 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.89.100 wrapped_avframe
[Parsed_showinfo_0 @ 0000022DB64CAFE0] n: 0 pts: 0 pts_time:0 pos: 8024408 fmt:yuv420p sar:1/1 s:1024x768 i:P iskey:0 type:P checksum:0846A9F1 plane_checksum:[673969F6 FCAF46D3 EDBFF919] mean:[134 128 127] stdev:[51.4 6.1 5.3]
[Parsed_showinfo_0 @ 0000022DB64CAFE0] n: 1 pts: 1 pts_time:0.04 pos: 8030298 fmt:yuv420p sar:1/1 s:1024x768 i:P iskey:0 type:P checksum:A9E18F96 plane_checksum:[5F374E71 A7C04AB7 EA8FF65F] mean:[134 128 127] stdev:[51.4 6.1 5.3]9E18F96 plane_checksum:[5F374E71 A7C04AB7 EA8FF65F] mean:[134 128 127] stdev:[51.4 6.1 5.3]

I am using Windows 10, GTX1070, Cuda 8.0.44 and ffmpeg 3.3

Hello, Liran.

Currently pkt_pos parameter in decoded AVFrame is always set to -1 within cuvid_output_frame() function @ libavcodec/cuvid.c