Skip to content

rtpsession: iterate ssrcs copy when scheduling remaining nacks#56

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-locking-and-hash-table-issue
Draft

rtpsession: iterate ssrcs copy when scheduling remaining nacks#56
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-locking-and-hash-table-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

rtp_session_on_timeout's final g_hash_table_foreach walks the live sess->ssrcs table while calling schedule_remaining_nacks, which drops the session lock to issue an upcall. If another thread inserts a source via obtain_source during that window, GLib's version check trips on resume:

GLib-CRITICAL: g_hash_table_foreach: assertion 'version == hash_table->version' failed

Changes

  • subprojects/gst-plugins-good/gst/rtpmanager/rtpsession.c — Apply the copy-then-iterate pattern already used by the update_source and generate_rtcp foreach sites earlier in the same function. clone_ssrcs_hashtable refs each source, so the copy stays valid across the unlock window inside schedule_remaining_nacks. No callback or locking semantics change.
RTP_SESSION_LOCK (sess);
table_copy = g_hash_table_new_full (NULL, NULL, NULL,
    (GDestroyNotify) g_object_unref);
g_hash_table_foreach (sess->ssrcs[sess->mask_idx],
    (GHFunc) clone_ssrcs_hashtable, table_copy);
g_hash_table_foreach (table_copy,
    (GHFunc) schedule_remaining_nacks, &data);
g_hash_table_destroy (table_copy);
RTP_SESSION_UNLOCK (sess);

Worth proposing upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants