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 534491 - caps changed checks only compare pointers
caps changed checks only compare pointers
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-23 13:40 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2008-05-29 08:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use gst_caps_is_equal (1.84 KB, patch)
2008-05-23 13:42 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2008-05-23 13:40:07 UTC
I currently track down a problem and noticed these messages in my log.
gstpad.c:2769:gst_pad_alloc_buffer_full:<output_level_0x83ae650:src> caps changed from (NULL) to 0x92bca40 audio/x-raw-float, ...

There are three places in gstpad.c where they are emitted. The code just compares the caps pointers and not the content. Imho this triggers renegotiation too often.

Using gst_caps_is_equal() would address this better. It has quick return path for common cases.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2008-05-23 13:42:36 UTC
Created attachment 111411 [details] [review]
use gst_caps_is_equal
Comment 2 Jan Schmidt 2008-05-23 16:27:26 UTC
This looks bad to me. It changes behaviour in undesireable 2 ways:

1) Pushing a buffer with NULL caps is now going to flag that the caps have changed and cause re-negotiation to a NULL caps.
2) Buffers can now pass around where the caps stored on the buffer are not the same caps instance as what's been configured on the pad, which has never been allowed before.

Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2008-05-23 17:56:32 UTC
Thanks for the feedback, thats why I was posting a patch. I get your point, I will try to figure what went wrong as I have the scenario, where pad and buffer have the same caps-format, but no the same caps object.

actualy basetransform uses gst_caps_is_equal() already - that should be rethough maybe...
Comment 4 Sebastian Dröge (slomo) 2008-05-25 09:09:30 UTC
In other places I remember to see things like

caps && (GST_PAD_CAPS (pad) == caps || gst_caps_is_equal (GST_PAD_CAPS (pad), caps))
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2008-05-29 08:40:32 UTC
We should probably define when we want to use 

caps_changed = caps && caps != GST_PAD_CAPS (pad);

and when

caps_changed = !gst_caps_is_equal (caps, GST_PAD_CAPS (pad));

The code in comment #4 is kind of superfluous, as includes cehcks for NULL and direct equivalence.