GNOME Bugzilla – Bug 693365
gst_structure_is_subset false positive
Last modified: 2013-05-28 20:08:12 UTC
gst_structure_is_subset() function returns TRUE for the following pair of structures:
SUPERSET: video/x-h264, parsed=(boolean)true
SUBSET: video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
It should return FALSE, since there's no parse=(boolean)true in SUBSET.
According to the docs, gst_structure_is_subset() does the following:
* Checks if @subset is a subset of @superset, i.e. has the same
* structure name and for all fields that are existing in @superset,
* @subset has a value that is a subset of the value in @superset.
In this example, @superset contains parsed=true field, and @subset does not contain a "parsed" field. Therefore, @subset does not have a value which is a subset of the value in @superset for that field.
The relevant part of gst_structure_is_subset() is this line:
return gst_structure_foreach ((GstStructure *) subset,
gst_caps_structure_is_subset_field, (gpointer) superset);
From the above line, it is clear that either the docs should say "for all fields that are existing in @subset, ..." or gst_structure_is_subset() should be fixed to act as described in the docs.
Which version of GStreamer are you using?
(In reply to comment #1)
> Which version of GStreamer are you using?
Tested with gstreamer-0.10.36. I've checked the code in current gstreamer git head and it looks just the same, so this should be reproducible with 1.0.*
I don't have resources to update my code for gstreamer-1.0 at the moment.
Created attachment 235773 [details] [review]
tests: add another test for gst_caps_is_subset()
The code is slightly different in 1.0, but this still fails in 1.0. Can also easily be tested via
gst-launch-1.0 uridecodebin uri=file:///foo.mp3 caps=audio/mpeg,parsed=true ! fakesink -v
Note how it doesn't plug an mpegaudioparse, but sends audio/mpeg, mpegversion=(int)1, layer=(int)3 to fakesink.
Author: Sebastian Dröge <email@example.com>
Date: Wed Feb 13 10:46:37 2013 +0100
structure: Make sure that subsets have all fields of the superset
"video/x-h264,parsed=(boolean)true" is not a superset of
and many related changes to unit tests and some elements everywhere.