Webrtcsink: Renegotiation is not supported, when used with nvh264enc and h264parse

I’ve tried the following pipelines with gstreamer 1.24 built from source with a few different variations with queues and capfilters

src ! bayer2rgb ! nvh264enc ! h264parse ! webrtcsink video-caps="video/x-h264"

src ! bayer2rgb ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! queue ! nvh264enc ! h264parse ! webrtcsink video-caps="video/x-h264"

I get the following error fairly immediately, it looks like the pipeline is adding a few extra caps into the stream at some point (newlines added for clarity):

webrtcsink net/webrtc/src/webrtcsink/imp.rs:3476:gstrswebrtc::webrtcsink::imp::BaseWebRTCSink::sink_event:<webrtcsink:video_0> 
Renegotiation is not supported (
old: video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)2.1, profile=(string)main, width=(int)480, height=(int)304, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)sRGB, parsed=(boolean)true, 
new: video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)2.1, profile=(string)main, width=(int)480, height=(int)304, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)sRGB, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true)

Here are the differences:

old: video/x-h264, ... colorimetry=(string)sRGB, parsed=(boolean)true
new: video/x-h264, ... colorimetry=(string)sRGB, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true)

I’m not sure how to either ensure that webrtcsink expects the extra caps immediately, or ensure that nvh264enc/h264parse doesn’t include those extra caps

I believe I’ve solved this with an aggressive capsfilter

! 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"

but now I’m seeing a new error:

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

Googling is not yielding any help. I will try to solve on my own for a bit before making a new issue.