mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
validate: Gracefully handle absence of TAG on streams
Summary: And do not segfault when it happens! Reviewers: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D99
This commit is contained in:
parent
adbe811175
commit
5d6fcb5727
2 changed files with 49 additions and 9 deletions
|
@ -162,11 +162,13 @@ serialize_filenode (GstMediaDescriptorWriter * writer)
|
|||
STR_APPEND1 ("</streams>");
|
||||
|
||||
tagsnode = filenode->tags;
|
||||
STR_APPEND1 (tagsnode->str_open);
|
||||
for (tmp2 = tagsnode->tags; tmp2; tmp2 = tmp2->next) {
|
||||
STR_APPEND2 (((TagNode *) tmp2->data)->str_open);
|
||||
if (tagsnode) {
|
||||
STR_APPEND1 (tagsnode->str_open);
|
||||
for (tmp2 = tagsnode->tags; tmp2; tmp2 = tmp2->next) {
|
||||
STR_APPEND2 (((TagNode *) tmp2->data)->str_open);
|
||||
}
|
||||
STR_APPEND1 (tagsnode->str_close);
|
||||
}
|
||||
STR_APPEND1 (tagsnode->str_close);
|
||||
|
||||
g_string_append (res, filenode->str_close);
|
||||
|
||||
|
@ -467,8 +469,8 @@ _run_frame_analisis (GstMediaDescriptorWriter * writer,
|
|||
writer->priv->pipeline = gst_pipeline_new ("frame-analisis");
|
||||
|
||||
monitor =
|
||||
gst_validate_monitor_factory_create (GST_OBJECT_CAST (writer->priv->
|
||||
pipeline), runner, NULL);
|
||||
gst_validate_monitor_factory_create (GST_OBJECT_CAST (writer->
|
||||
priv->pipeline), runner, NULL);
|
||||
gst_validate_reporter_set_handle_g_logs (GST_VALIDATE_REPORTER (monitor));
|
||||
|
||||
g_object_set (uridecodebin, "uri", uri, "caps", writer->priv->raw_caps, NULL);
|
||||
|
|
|
@ -215,10 +215,48 @@ compare_tags (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
TagsNode *rtags, *ctags;
|
||||
|
||||
rtags = rstream->tags;
|
||||
if (rtags == NULL)
|
||||
return 1;
|
||||
|
||||
ctags = cstream->tags;
|
||||
if (rtags == NULL && ctags)
|
||||
return 1;
|
||||
else if (!rtags && ctags) {
|
||||
GList *taglist;
|
||||
GString *all_tags = g_string_new (NULL);
|
||||
|
||||
for (taglist = ctags->tags; taglist; taglist = taglist->next) {
|
||||
gchar *stags =
|
||||
gst_tag_list_to_string (((TagNode *) taglist->data)->taglist);
|
||||
|
||||
g_string_append_printf (all_tags, "%s\n", stags);
|
||||
g_free (stags);
|
||||
}
|
||||
|
||||
GST_VALIDATE_REPORT (ref, FILE_TAG_DETECTION_INCORRECT,
|
||||
"Reference descriptor for stream %s has NO tags"
|
||||
" but tags found: %s", all_tags->str);
|
||||
|
||||
g_string_free (all_tags, TRUE);
|
||||
|
||||
return 0;
|
||||
} else if (rtags && !ctags) {
|
||||
GList *taglist;
|
||||
GString *all_tags = g_string_new (NULL);
|
||||
|
||||
for (taglist = rtags->tags; taglist; taglist = taglist->next) {
|
||||
gchar *stags =
|
||||
gst_tag_list_to_string (((TagNode *) taglist->data)->taglist);
|
||||
|
||||
g_string_append_printf (all_tags, "%s\n", stags);
|
||||
g_free (stags);
|
||||
}
|
||||
|
||||
GST_VALIDATE_REPORT (ref, FILE_TAG_DETECTION_INCORRECT,
|
||||
"Reference descriptor for stream %s has tags:\n %s\n"
|
||||
" but NO tags found on the stream");
|
||||
|
||||
g_string_free (all_tags, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (rtag_list = rtags->tags; rtag_list; rtag_list = rtag_list->next) {
|
||||
rtag = rtag_list->data;
|
||||
found = FALSE;
|
||||
|
|
Loading…
Reference in a new issue