h264parse: parse unregistered SEI without user data

We get loads of warnings when parsing videos from users:

gsth264parser.c:1115:gst_h264_parser_parse_user_data_unregistered: No more remaining payload data to store
gsth264parse.c:646:gst_h264_parse_process_sei:<h264parse0> failed to parse one or more SEI message

Those are raised because of unregistered SEI without user data.

The spec does not explicitly state that unregistered SEI needs to have
data and I suppose the UUID by itself can carry valuable information.
FFmpeg also parses and exposes such SEI so there is no reason for us no
too as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7931>
This commit is contained in:
Guillaume Desmottes 2024-11-20 14:16:23 +01:00 committed by GStreamer Marge Bot
parent e67c997970
commit 082a8fcd5e
5 changed files with 27 additions and 12 deletions

View file

@ -16746,7 +16746,7 @@ parameters.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-sei.c">User Data Unregistered UUID</doc>
<type name="guint8" c:type="guint8*"/>
</parameter>
<parameter name="data" transfer-ownership="none">
<parameter name="data" transfer-ownership="none" nullable="1" allow-none="1">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-sei.c">SEI User Data Unregistered buffer</doc>
<type name="guint8" c:type="guint8*"/>
</parameter>

View file

@ -1111,12 +1111,6 @@ gst_h264_parser_parse_user_data_unregistered (GstH264NalParser * nalparser,
READ_UINT8 (nr, data[i], 8);
}
if (payload_size < 1) {
GST_WARNING ("No more remaining payload data to store");
g_clear_pointer (&data, g_free);
return GST_H264_PARSER_BROKEN_DATA;
}
urud->data = data;
GST_MEMDUMP ("SEI user data unregistered", data, payload_size);
return GST_H264_PARSER_OK;

View file

@ -623,9 +623,6 @@ gst_h264_parse_process_sei_user_data_unregistered (GstH264Parse * h264parse,
{
GstByteReader br;
if (urud->data == NULL || urud->size < 1)
return;
gst_byte_reader_init (&br, urud->data, urud->size);
gst_video_parse_user_data_unregistered ((GstElement *) h264parse,

View file

@ -1488,6 +1488,16 @@ GST_START_TEST (test_parse_sei_userdefinedunregistered)
0x1f, 0x00, 0x05, 0xff, 0x21, 0x7e, 0xff, 0x29,
0xb5, 0xff, 0xdc, 0x13
};
// Same SEI as above but without data
const guint8 no_data_sei[] = {
0x00, 0x00, 0x00, 0x20, 0x06, 0x05, 0x10, 0x4d,
0x49, 0x53, 0x50, 0x6d, 0x69, 0x63, 0x72, 0x6f,
0x73, 0x65, 0x63, 0x74, 0x69, 0x6d, 0x65,
/* IDR frame (doesn't match caps) */
0x00, 0x00, 0x00, 0x14, 0x65, 0x88, 0x84, 0x00,
0x10, 0xff, 0xfe, 0xf6, 0xf0, 0xfe, 0x05, 0x36,
0x56, 0x04, 0x50, 0x96, 0x7b, 0x3f, 0x53, 0xe1
};
h = gst_harness_new ("h264parse");
@ -1511,6 +1521,21 @@ GST_START_TEST (test_parse_sei_userdefinedunregistered)
gst_buffer_unref (buf);
// Now try parsing an unregistered SEI without data
buf = gst_buffer_new_and_alloc (misb_sei_size);
gst_buffer_fill (buf, 0, no_data_sei, sizeof (no_data_sei));
fail_unless_equals_int (gst_harness_push (h, buf), GST_FLOW_OK);
buf = gst_harness_pull (h);
meta = gst_buffer_get_video_sei_user_data_unregistered_meta (buf);
fail_unless (meta != NULL);
fail_unless (memcmp (meta->uuid, H264_MISP_MICROSECTIME, 16) == 0);
fail_unless (meta->data == NULL);
fail_unless (meta->size == 0);
gst_buffer_unref (buf);
gst_harness_teardown (h);
}

View file

@ -156,7 +156,7 @@ gst_video_sei_user_data_unregistered_meta_get_info (void)
* gst_buffer_add_video_sei_user_data_unregistered_meta:
* @buffer: a #GstBuffer
* @uuid: User Data Unregistered UUID
* @data: (transfer none): SEI User Data Unregistered buffer
* @data: (transfer none) (allow-none): SEI User Data Unregistered buffer
* @size: size of the data buffer
*
* Attaches #GstVideoSEIUserDataUnregisteredMeta metadata to @buffer with the given
@ -172,7 +172,6 @@ gst_buffer_add_video_sei_user_data_unregistered_meta (GstBuffer * buffer,
{
GstVideoSEIUserDataUnregisteredMeta *meta;
g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
g_return_val_if_fail (data != NULL, NULL);
meta = (GstVideoSEIUserDataUnregisteredMeta *) gst_buffer_add_meta (buffer,
GST_VIDEO_SEI_USER_DATA_UNREGISTERED_META_INFO, NULL);