Trouble using nvh264enc with webrtcsink (rs version)

I have the following stream where I’m trying to hardware encode video/x-raw to h264 and send to webrtcsink.

my-src ! bayer2rgb ! capsfilter caps="video/x-raw,format=RGBx" ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! nvh264enc ! h264parse 
! capsfilter caps="video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)2.1, profile=(string)main, width=(int)480, height=(int)304, framerate=(fraction)30/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8"
! webrtcsink video-caps="video/x-h264"

When I run the pipeline I get the error below and no frames via webrtc. Removing the h264parse element has no effect. Additionally, when I run nvidia-smi encodersessions I see that a session gets created and vram is used, but the average fps and latency are always zero.

0:00:22.222943224  1176 0x7f37740011a0 WARN       codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0
0:00:22.223103477  1176 0x7f37740011a0 WARN               h264parse gsth264parse.c:2028:gst_h264_parse_handle_frame:<h264parse1> Failed to update backlog

I’ve replaced webrtcsink with avimux ! filesink location=output.avi and it works, but I suspect it’s still not using the hardware encoder because nvidia-smi encodersessions still shows average fps and latency as zero.

I’m pretty stumped after working on this all day.