Skip to content

gateway: fix dropped audio by sharing one data-session per direction#9

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-audio-packet-flow
Draft

gateway: fix dropped audio by sharing one data-session per direction#9
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-audio-packet-flow

Conversation

Copilot AI commented May 19, 2026

Copy link
Copy Markdown
Contributor

In pulse_gateway, audio frames were arriving on each leg's OUTPUT but never made it across to the other leg's INPUT, while video forwarded fine.

Root cause

open_data_sessions() called pulse_data_session_connect_input() twice on the same PULSE_MEDIA_CONTENT_MAIN slot — once with an audio-only config, then once with a video-only config. Each MAIN slot holds exactly one input config (and one output config); the second call silently replaces the first. The input session ended up video-only, so every audio push_frame() was dropped. Same shape of bug on the output side.

Changes in src/gateway.cpp

  • Combined configs. Replaced the four per-media config builders with make_input_config() / make_output_config() that describe audio and video together via PULSE_DATA_SESSION_AUDIO_FROM_VALUES_VIDEO_FROM_VALUES (input) and ..._VIDEO_FROM_CAPS (output). open_data_sessions() now issues exactly one connect_input and one connect_output per leg.
  • Error logging. PulseError returns from connect_input, connect_output, and push_frame are checked and logged to stderr (push errors are rate-limited 1-in-100). The original silent-drop would have been obvious from day one had these been checked.
  • UI string. Fixed the panel blurb claiming the bridge moves "RGBA video and S16LE PCM audio" — it's I420 + F32LE, matching kVideoCaps and the audio config.

The per-frame update_config mechanism for video resolution changes is unchanged: PulseDataSessionFrame carries audio and video PulseDataSessionFrameData side by side, so one shared session per direction is what the API actually expects.

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