summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-06-21 10:24:15 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-06-27 09:29:55 +0300
commit4348df8e4a1644ed4c1f8405bba46b8f5946eda6 (patch)
tree5599c8b005abedbc7db8153fa9102f214f3d7376
parent70f3750773bf5dba4098f6d72d63aa6c84f1f539 (diff)
downloadgstreamer-plugins-base-4348df8e4a1644ed4c1f8405bba46b8f5946eda6.tar.gz
discoverer: Only allow serializing OK discoverer infos to GVariants
They will be incomplete otherwise and we can't generate the full serialized information, and instead will crash somewhere on the way. https://bugzilla.gnome.org/show_bug.cgi?id=767859
-rw-r--r--gst-libs/gst/pbutils/gstdiscoverer.c5
-rw-r--r--tests/check/libs/discoverer.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c
index af2046a6a..45de5f599 100644
--- a/gst-libs/gst/pbutils/gstdiscoverer.c
+++ b/gst-libs/gst/pbutils/gstdiscoverer.c
@@ -2200,11 +2200,14 @@ gst_discoverer_info_to_variant (GstDiscovererInfo * info,
/* FIXME: implement TOC support */
GVariant *stream_variant;
GVariant *variant;
- GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info);
+ GstDiscovererStreamInfo *sinfo;
GVariant *wrapper;
g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+ g_return_val_if_fail (gst_discoverer_info_get_result (info) ==
+ GST_DISCOVERER_OK, NULL);
+ sinfo = gst_discoverer_info_get_stream_info (info);
stream_variant = gst_discoverer_info_to_variant_recurse (sinfo, flags);
variant =
g_variant_new ("(vv)", _serialize_info (info, flags), stream_variant);
diff --git a/tests/check/libs/discoverer.c b/tests/check/libs/discoverer.c
index 8fe5ecf5f..aa2b9a943 100644
--- a/tests/check/libs/discoverer.c
+++ b/tests/check/libs/discoverer.c
@@ -66,6 +66,8 @@ GST_START_TEST (test_disco_serializing)
info = gst_discoverer_discover_uri (dc, uri, &err);
fail_unless (info);
+ fail_unless_equals_int (gst_discoverer_info_get_result (info),
+ GST_DISCOVERER_OK);
serialized =
gst_discoverer_info_to_variant (info, GST_DISCOVERER_SERIALIZE_ALL);