Nvcodec: stream doesn't play after transcoding with nvh264dec decoder

I have problems with transcoding streams when I use the nvh264dec hardware decoder in combination with nvh264enc in gstreamer.
The receiving side isn’t able to play the streams if it’s transcoded with these elements. If I replace nvh264dec for avdec_h264 (software decoding) everything is fine.

The bug is described here:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1477

Does anyone know a workaround for this problem? I can’t imagine other people aren’t experiencing this problem.

Thanks!

nvh264sldec seems to work with correct timestamps.