h264parse: Require codec_data when receiving stream-format=avc or avc3
It's not really possible to safely interpret the content afterwards if it's missing. Even for AVC3, the codec_data doesn't need to contain a SPS/PPS, but it still needs to be present to tell downstream elements about the size of the nal unit length field. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8955>
This commit is contained in:
parent
ffed473992
commit
f13c757696
@ -3692,8 +3692,9 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||
}
|
||||
|
||||
/* avc caps sanity checks */
|
||||
if (format == GST_H264_PARSE_FORMAT_AVC) {
|
||||
/* AVC requires codec_data, AVC3 might have one and/or SPS/PPS inline */
|
||||
if (format == GST_H264_PARSE_FORMAT_AVC ||
|
||||
format == GST_H264_PARSE_FORMAT_AVC3) {
|
||||
/* AVC and AVC3 requires codec_data */
|
||||
if (codec_data_value == NULL)
|
||||
goto avc_caps_codec_data_missing;
|
||||
|
||||
@ -3711,7 +3712,7 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||
goto bytestream_caps_with_codec_data;
|
||||
}
|
||||
|
||||
/* packetized video has codec_data (required for AVC, optional for AVC3) */
|
||||
/* packetized video has codec_data (required for AVC and AVC3) */
|
||||
if (codec_data_value != NULL) {
|
||||
GstMapInfo map;
|
||||
guint i;
|
||||
@ -3772,7 +3773,8 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||
/* we have 4 sync bytes */
|
||||
h264parse->nal_length_size = 4;
|
||||
} else {
|
||||
/* probably AVC3 without codec_data field, anything to do here? */
|
||||
/* probably avc1 or avc3 without codec_data field, its invalid */
|
||||
goto codec_data_missing;
|
||||
}
|
||||
|
||||
{
|
||||
@ -3834,6 +3836,12 @@ avcC_failed:
|
||||
GST_DEBUG_OBJECT (h264parse, "Failed to parse avcC data");
|
||||
goto refuse_caps;
|
||||
}
|
||||
codec_data_missing:
|
||||
{
|
||||
GST_WARNING_OBJECT (h264parse, "Is not bytestream and lacks codec_data,"
|
||||
" invalid caps: %" GST_PTR_FORMAT, caps);
|
||||
goto refuse_caps;
|
||||
}
|
||||
refuse_caps:
|
||||
{
|
||||
GST_WARNING_OBJECT (h264parse, "refused caps %" GST_PTR_FORMAT, caps);
|
||||
|
Loading…
x
Reference in New Issue
Block a user