rtph264pay: Reject stream-format=avc without codec_data

Without the codec_data, it's impossible to know the size of the field
for the number of NALu in a buffer. And since nal_length_size is unkown
the stream can't be parsed and payloaded and we risk an infinite loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8954>
This commit is contained in:
Olivier Crête 2025-05-07 22:19:44 -04:00 committed by GStreamer Marge Bot
parent 380a947155
commit 14f833fdcf

View File

@ -682,7 +682,13 @@ gst_rtp_h264_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
gst_buffer_unmap (buffer, &map);
} else {
GST_DEBUG_OBJECT (rtph264pay, "have bytestream h264");
if (rtph264pay->stream_format == GST_H264_STREAM_FORMAT_AVC) {
GST_ERROR_OBJECT (rtph264pay, "Caps have stream-format=avc but lack "
"codec_data, rejecting: %" GST_PTR_FORMAT, caps);
return FALSE;
} else {
GST_DEBUG_OBJECT (rtph264pay, "have bytestream h264");
}
}
return TRUE;