Commit 26f63db4 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

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
parent 2ac5bd29
...@@ -2200,11 +2200,14 @@ gst_discoverer_info_to_variant (GstDiscovererInfo * info, ...@@ -2200,11 +2200,14 @@ gst_discoverer_info_to_variant (GstDiscovererInfo * info,
/* FIXME: implement TOC support */ /* FIXME: implement TOC support */
GVariant *stream_variant; GVariant *stream_variant;
GVariant *variant; GVariant *variant;
GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info); GstDiscovererStreamInfo *sinfo;
GVariant *wrapper; GVariant *wrapper;
g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL); 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); stream_variant = gst_discoverer_info_to_variant_recurse (sinfo, flags);
variant = variant =
g_variant_new ("(vv)", _serialize_info (info, flags), stream_variant); g_variant_new ("(vv)", _serialize_info (info, flags), stream_variant);
......
...@@ -66,6 +66,8 @@ GST_START_TEST (test_disco_serializing) ...@@ -66,6 +66,8 @@ GST_START_TEST (test_disco_serializing)
info = gst_discoverer_discover_uri (dc, uri, &err); info = gst_discoverer_discover_uri (dc, uri, &err);
fail_unless (info); fail_unless (info);
fail_unless_equals_int (gst_discoverer_info_get_result (info),
GST_DISCOVERER_OK);
serialized = serialized =
gst_discoverer_info_to_variant (info, GST_DISCOVERER_SERIALIZE_ALL); gst_discoverer_info_to_variant (info, GST_DISCOVERER_SERIALIZE_ALL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment