Skip to content

INT-4410: fix sound device never closing due to async bridge count - #18

Draft
darshan-verkada wants to merge 1 commit into
intercom/release-2-15from
darshanpatel/int-10581-fix-sound-device-close-issue
Draft

INT-4410: fix sound device never closing due to async bridge count#18
darshan-verkada wants to merge 1 commit into
intercom/release-2-15from
darshanpatel/int-10581-fix-sound-device-close-issue

Conversation

@darshan-verkada

Copy link
Copy Markdown

pjsua_check_snd_dev_idle() checked pjmedia_conf_get_connect_count() when scheduling the idle timer, but bridge disconnect is async: connect_cnt is only decremented later by the conference clock thread, so the count was always stale at the scheduling site and the timer never got armed, leaving the sound device (and its realtime ALSA threads) open forever.

Move the connect-count check into the timer callback, where it fires after the op queue has drained, and re-arm the timer instead of dropping it if the count is still non-zero — otherwise a declined close has no guaranteed later event to retry it. Keep the existing call_cnt <= 1 relaxation that lets the device close during an active call whose audio was handed off to LiveKit.

Claude-Session: https://claude.ai/code/session_01AEfmqRvAxKXxFzPoe2pmu3

pjsua_check_snd_dev_idle() checked pjmedia_conf_get_connect_count() when
scheduling the idle timer, but bridge disconnect is async: connect_cnt
is only decremented later by the conference clock thread, so the count
was always stale at the scheduling site and the timer never got armed,
leaving the sound device (and its realtime ALSA threads) open forever.

Move the connect-count check into the timer callback, where it fires
after the op queue has drained, and re-arm the timer instead of
dropping it if the count is still non-zero — otherwise a declined
close has no guaranteed later event to retry it. Keep the existing
call_cnt <= 1 relaxation that lets the device close during an active
call whose audio was handed off to LiveKit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AEfmqRvAxKXxFzPoe2pmu3
@linear-code

linear-code Bot commented Jul 25, 2026

Copy link
Copy Markdown

INT-10581

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.

1 participant