Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pipewire pipewire
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PipeWirePipeWire
  • pipewirepipewire
  • Issues
  • #226
Closed
Open
Issue created Apr 01, 2020 by George Kiagiadakis@gkiagiaOwner

spa_pod_filter silently requires a newly initialized builder

Not sure if this is a bug or something that just needs to be documented, but I observed this awkward behavior in this code:

char buf[1024];
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));

g_autoptr (GPtrArray) params =
    wp_spa_props_build_propinfo (&priv->spa_props, &b);

for (guint i = start; i < params->len; i++) {
  struct spa_pod *param = g_ptr_array_index (params, i);

  if (spa_pod_filter (&b, &result, param, filter) == 0) {
    pw_session_emit_param (&self->hooks, seq, id, i, i+1, result);
    if (++count == num)
      break;
  }
}

wp_spa_props_build_propinfo essentially builds an array of spa_pod* that contains all the PropInfo params. Then I iterate over it and filter it, using the same builder. What actually happens here is that the result spa_pod is always the same and equals the very first spa_pod* in the params array.

The reason is that spa_pod_filter() internally does: *result = (struct spa_pod*)b->data;, so if the builder is shared to build something else before calling spa_pod_filter(), the result of the filter is wrong.

Assignee
Assign to
Time tracking