Skip to content

pjmedia: pass application data to the conference operation callback - #5320

Merged
nanangizz merged 1 commit into
masterfrom
feat/conf-op-user-data
Oct 9, 2026
Merged

nanangizz merged 1 commit into
masterfrom
feat/conf-op-user-data

Conversation

@nanangizz

Copy link
Copy Markdown
Member

An application running several conference bridges, each wrapped in its own object, can't tell which object a pjmedia_conf_set_op_cb() callback belongs to without keeping its own map from bridge to owner. #4699 added the bridge pointer to pjmedia_conf_op_info; this adds application data.

  • pjmedia_conf_param::user_data (default NULL) is set at creation with pjmedia_conf_create2(), and passed back in the new pjmedia_conf_op_info::user_data. No new API, pjmedia_conf_set_op_cb() is unchanged.
  • Filled at every invocation of the callback, in both the serial (conference.c) and the parallel (conf_thread.c) bridge: the queued operations, the cancelled operations and the synchronous removal in pjmedia_conf_remove_port(), and the removals in pjmedia_conf_destroy(). The switch board backend has no operation callback.
  • Fix: the parallel bridge, the default backend, reported queued operations with pjmedia_conf_op_info::conf set to NULL.

conf_test gains op_user_data_test(): it removes a port before its add-op has run, then lets the clock complete a queued add-op, then destroys the bridge, and checks every callback carries the bridge and the user data. Without the change it fails on both the serial and the parallel bridge.

Based on a patch by Christian Becker.

Co-Authored-By Claude Code

Add user_data to pjmedia_conf_param, passed back in the new
pjmedia_conf_op_info::user_data at every invocation of the operation
callback, in the serial and the parallel bridge.

Also set pjmedia_conf_op_info::conf for the queued operations of the
parallel bridge, which were reported with a NULL conf.

Based on a patch by Christian Becker.

Co-Authored-By Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The callback context is consistently initialized across supported backends and covered by focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Adds application context to conference operation callbacks, enabling callers to identify the owning conference bridge.

Changes:

  • Adds user_data to conference creation parameters and callback information.
  • Propagates bridge and user data through serial and parallel callback paths.
  • Adds callback coverage for queued, cancelled, synchronous, and destruction operations.
File Description
pjmedia/​include/​pjmedia/​conference.h Defines and documents callback user data.
pjmedia/​src/​pjmedia/​conference.c Propagates user data in the serial backend.
pjmedia/​src/​pjmedia/​conf_thread.c Propagates bridge and user data in the parallel backend.
pjmedia/​src/​test/​conf_test.c Tests callback context across operation paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nanangizz
nanangizz requested a review from sauwming October 7, 2026 07:47
@nanangizz
nanangizz merged commit a30d0c6 into master Oct 9, 2026
68 checks passed
@nanangizz
nanangizz deleted the feat/conf-op-user-data branch October 9, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants