After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 693365 - gst_structure_is_subset false positive
gst_structure_is_subset false positive
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal normal
: 1.0.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-07 21:49 UTC by Dmitry Shatrov
Modified: 2013-05-28 20:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: add another test for gst_caps_is_subset() (999 bytes, patch)
2013-02-12 10:13 UTC, Tim-Philipp Müller
none Details | Review

Description Dmitry Shatrov 2013-02-07 21:49:53 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.
Comment 1 Sebastian Dröge (slomo) 2013-02-12 09:10:29 UTC
Which version of GStreamer are you using?
Comment 2 Dmitry Shatrov 2013-02-12 10:01:05 UTC
(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.
Comment 3 Tim-Philipp Müller 2013-02-12 10:13:18 UTC
Created attachment 235773 [details] [review]
tests: add another test for gst_caps_is_subset()
Comment 4 Tim-Philipp Müller 2013-02-12 10:16:13 UTC
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.
Comment 5 Sebastian Dröge (slomo) 2013-02-13 14:30:47 UTC
commit 171c79c9a7a54a7e36dbc6612ac06f659ef9d0dd
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
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
    "video/x-h264,stream-format=(string)byte-stream,alignment=(string)nal"
    for example.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693365


and many related changes to unit tests and some elements everywhere.