Skip to content

gstvalue: Use interned strings wherever possible

Edward Hervey requested to merge bilboed/gstreamer:internstring into master

gstvalue: Use interned strings wherever possible

Strings are used extensively in caps (and therefore in structures as GValue of
type G_TYPE_STRING.

The problem is that:
* They imply a memory copy (strdup) whenever we need to copy that value, even
temporarily
* They require expensive strcmp calls to check whether the value is equal or
not.

Instead of that, let's "intern" all the strings used for caps by using the new
G_VALUE_INTERNED_STRING feature (or our copy if not yet available)

With this in place we can now:
* Copy strings for "free" (we point to the same interned string location)
* Compare immediately if both strings we are comparing are interned
 
 Fixes #521

pad: Promote accept-caps performance warning

This impact on performance is really quite severe for caps negotiation, make
sure it's a bit more visible

check: Add checks for value lists

We didn't have any. Could be expanded, but it's a start.
Edited by Tim-Philipp Müller

Merge request reports