feat: fix voice join/leave, channel edit defaults, channel-update stream restart
Three bugs fixed across the full stack (proto/server/core/ABI/Win/macOS/iOS): 1. Join/Leave Voice now truly subscribes/unsubscribes from the voice plane. Previously the button only toggled the local mic — receiving was always on (gated by channel membership alone). Added a protocol-level voice subscription concept: new SubscribeVoiceRequest/UnsubscribeVoiceRequest/VoiceSubscriptionResult proto messages, User.voice_subscribed field, vc_join_voice/vc_leave_voice C ABI functions, VC_EVENT_VOICE_STATE event, server-side voice_subscribed flag checked by the SFU relay recipient filter, and core-client gating of remote-stream decoder setup. All three clients rewired to subscribe+mic on Join / unsubscribe on Leave. Text chat works regardless of voice subscription. 2. Channel edit dialog now shows the channel's actual current settings. The read struct vc_channel was missing sort_order and audio fields — only the write struct vc_channel_info had them. Extended vc_channel with both (additive, no ABI break), updated the session model and list_channels marshaling to populate them, and updated all three clients' edit callers to use actual channel info instead of hardcoded defaults. 3. Channel parameter updates now automatically restart everyone's streams. Previously editing a channel's audio config persisted and broadcast a ChannelEvent::UPDATED, but no layer restarted streams — encoders/decoders are frozen at announce time. handle_channel_event now detects audio-config changes on the user's current channel and stop->starts each active local stream. The server reads the updated config on re-announce; peers wire up fresh decoders at the new ssrc. All 29 CTest tests pass; Windows DLL + C# client build clean. Apple clients not yet compile-verified (Windows environment).
This commit is contained in:
@@ -145,6 +145,10 @@ typedef enum vc_event_type {
|
||||
vc_delete_channel/vc_create_account/vc_reset_password/
|
||||
vc_delete_account. */
|
||||
VC_EVENT_ACCOUNT_LIST = 15, /* Reply to vc_list_accounts. */
|
||||
VC_EVENT_VOICE_STATE = 16, /* u32a = subscribed(0/1). Reply to vc_join_voice()/
|
||||
vc_leave_voice(), and also emitted when the server
|
||||
changes your voice-subscription state. The user list
|
||||
(vc_user) carries per-user voice_subscribed. */
|
||||
} vc_event_type;
|
||||
|
||||
/* TOFU server-identity classification (M4) — see VC_EVENT_SERVER_IDENTITY and
|
||||
@@ -292,6 +296,10 @@ typedef struct vc_channel {
|
||||
const char* topic;
|
||||
int password_protected; /* bool */
|
||||
uint32_t max_users; /* 0 = unlimited */
|
||||
uint32_t sort_order; /* channel sort order */
|
||||
/* Authoritative channel Opus params (docs/voice.md §3). Populated from the Channel proto
|
||||
* so the edit dialog can read back the current config without a separate round-trip. */
|
||||
vc_audio_config audio;
|
||||
} vc_channel;
|
||||
|
||||
typedef struct vc_channel_list {
|
||||
@@ -308,6 +316,7 @@ typedef struct vc_user {
|
||||
int self_deafened; /* bool */
|
||||
int server_muted; /* bool */
|
||||
int server_deafened; /* bool */
|
||||
int voice_subscribed; /* bool — true when on the voice plane */
|
||||
} vc_user;
|
||||
|
||||
typedef struct vc_user_list {
|
||||
@@ -366,6 +375,16 @@ VC_API vc_result vc_join_channel(vc_client* c, uint32_t channel_id,
|
||||
const char* password /* nullable */);
|
||||
VC_API vc_result vc_leave_channel(vc_client* c);
|
||||
|
||||
/* ── Voice-plane subscription ─────────────────────────────────────────────── */
|
||||
/* Joining voice subscribes to the voice plane: the server starts relaying voice frames
|
||||
* to you, and the core wires up remote-stream decoders so you hear other users. Leaving
|
||||
* voice unsubscribes: the server stops relaying voice to you, the core tears down all
|
||||
* remote decoders (playback stops), and any active local mic/screen/aux streams are
|
||||
* stopped. Text chat is unaffected either way. Result arrives as VC_EVENT_VOICE_STATE
|
||||
* (u32a = 1 for subscribed, 0 for unsubscribed). */
|
||||
VC_API vc_result vc_join_voice(vc_client* c);
|
||||
VC_API vc_result vc_leave_voice(vc_client* c);
|
||||
|
||||
/* ── Local media streams (mic / screen audio / aux) ───────────────────────── */
|
||||
VC_API vc_result vc_stream_start(vc_client* c, const vc_stream_desc* desc,
|
||||
uint32_t* out_stream_id);
|
||||
|
||||
Reference in New Issue
Block a user