From 82ffd9c53e57a41deee5b9c220e7c1b216b7b34a Mon Sep 17 00:00:00 2001 From: Vineeth TM Date: Thu, 23 Jul 2015 15:51:09 +0900 Subject: [PATCH] validate: descriptor-writer: Handle error when stream info is not available There is no check to see if stream info is available. This leads to assertion error. Adding proper error messages for the same and reported the same as a validate warning message. https://bugzilla.gnome.org/show_bug.cgi?id=752758 --- validate/gst/validate/gst-validate-report.c | 2 ++ validate/gst/validate/gst-validate-report.h | 1 + .../gst/validate/media-descriptor-writer.c | 21 ++++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/validate/gst/validate/gst-validate-report.c b/validate/gst/validate/gst-validate-report.c index 16b1bb884c..ae648d776c 100644 --- a/validate/gst/validate/gst-validate-report.c +++ b/validate/gst/validate/gst-validate-report.c @@ -299,6 +299,8 @@ gst_validate_report_load_issues (void) _("resulting file stream profiles didn't match expected values"), NULL); REGISTER_VALIDATE_ISSUE (ISSUE, FILE_TAG_DETECTION_INCORRECT, _("detected tags are different than expected ones"), NULL); + REGISTER_VALIDATE_ISSUE (WARNING, FILE_NO_STREAM_INFO, + _("the discoverer could not determine the stream info"), NULL); REGISTER_VALIDATE_ISSUE (WARNING, FILE_NO_STREAM_ID, _("the discoverer found a stream that had no stream ID"), NULL); diff --git a/validate/gst/validate/gst-validate-report.h b/validate/gst/validate/gst-validate-report.h index 807a217258..d93b526da7 100644 --- a/validate/gst/validate/gst-validate-report.h +++ b/validate/gst/validate/gst-validate-report.h @@ -91,6 +91,7 @@ typedef enum { #define STATE_CHANGE_FAILURE _QUARK("state::change-failure") +#define FILE_NO_STREAM_INFO _QUARK("file-checking::no-stream-info") #define FILE_NO_STREAM_ID _QUARK("file-checking::no-stream-id") #define FILE_TAG_DETECTION_INCORRECT _QUARK("file-checking::tag-detection-incorrect") #define FILE_SIZE_INCORRECT _QUARK("file-checking::size-incorrect") diff --git a/validate/gst/validate/media-descriptor-writer.c b/validate/gst/validate/media-descriptor-writer.c index f282a9ea8e..12a772a20d 100644 --- a/validate/gst/validate/media-descriptor-writer.c +++ b/validate/gst/validate/media-descriptor-writer.c @@ -576,17 +576,22 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner, streaminfo = gst_discoverer_info_get_stream_info (info); - if (GST_IS_DISCOVERER_CONTAINER_INFO (streaminfo)) { - ((GstMediaDescriptor *) writer)->filenode->caps = - gst_discoverer_stream_info_get_caps (GST_DISCOVERER_STREAM_INFO - (streaminfo)); + if (streaminfo) { + if (GST_IS_DISCOVERER_CONTAINER_INFO (streaminfo)) { + ((GstMediaDescriptor *) writer)->filenode->caps = + gst_discoverer_stream_info_get_caps (GST_DISCOVERER_STREAM_INFO + (streaminfo)); - streams = gst_discoverer_info_get_stream_list (info); - for (tmp = streams; tmp; tmp = tmp->next) { - gst_media_descriptor_writer_add_stream (writer, tmp->data); + streams = gst_discoverer_info_get_stream_list (info); + for (tmp = streams; tmp; tmp = tmp->next) { + gst_media_descriptor_writer_add_stream (writer, tmp->data); + } + } else { + gst_media_descriptor_writer_add_stream (writer, streaminfo); } } else { - gst_media_descriptor_writer_add_stream (writer, streaminfo); + GST_VALIDATE_REPORT (writer, FILE_NO_STREAM_INFO, + "Discoverer info, does not contain the stream info"); } media_descriptor = (GstMediaDescriptor *) writer;