fix(M2): wire vc_client's real voice plane through the C ABI, not just raw sockets
test_m2_voice passed against raw BSD sockets, but vc_client::stream_start/stop, UDP binding, and capture/recv were still VC_ERR_NOT_IMPLEMENTED stubs -- meaning vccli and any GUI client still couldn't actually talk. Implements the real client-side UDP-binding handshake, media key derivation, capture->encode->seal-> send and recv->open->decode->playback paths, plus server-side StreamInfo broadcast so peers learn about each other's streams via sync_remote_streams(). Adds test_voice_client_abi (two real vc_client instances, not raw sockets) and vccli --voice/--mute/--text flags, manually verified live between two instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,10 @@ void ConnSession::on_frame(std::vector<uint8_t> frame) {
|
||||
if (st == State::Authenticated)
|
||||
handle_stream_announce(env.request_id(), env.stream_announce());
|
||||
break;
|
||||
case voicecat::v1::Envelope::kStreamStop:
|
||||
if (st == State::Authenticated)
|
||||
handle_stream_stop(env.stream_stop());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -346,7 +350,37 @@ void ConnSession::handle_stream_announce(uint64_t req_id,
|
||||
if (eff->bitrate_bps() == 0) eff->set_bitrate_bps(24000);
|
||||
if (eff->frame_ms() == 0) eff->set_frame_ms(20);
|
||||
|
||||
announced_stream_id_ = res->stream_id();
|
||||
|
||||
voicecat::v1::StreamInfo info;
|
||||
info.set_stream_id(res->stream_id());
|
||||
info.set_ssrc(ssrc);
|
||||
info.set_kind(msg.kind());
|
||||
*info.mutable_audio() = *eff;
|
||||
info.set_label(msg.label());
|
||||
|
||||
send_envelope(env);
|
||||
|
||||
auto updated = registry_->set_user_stream(user_id_.load(), info);
|
||||
if (updated) {
|
||||
auto bcast = make_env();
|
||||
auto* ue = bcast.mutable_user_event();
|
||||
ue->set_kind(voicecat::v1::UserEvent::UPDATED);
|
||||
*ue->mutable_user() = *updated;
|
||||
registry_->broadcast(bcast, session_id_);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnSession::handle_stream_stop(const voicecat::v1::StreamStop& msg) {
|
||||
auto updated = registry_->clear_user_stream(user_id_.load(), msg.stream_id());
|
||||
if (msg.stream_id() == announced_stream_id_) announced_stream_id_ = 0;
|
||||
if (updated) {
|
||||
auto bcast = make_env();
|
||||
auto* ue = bcast.mutable_user_event();
|
||||
ue->set_kind(voicecat::v1::UserEvent::UPDATED);
|
||||
*ue->mutable_user() = *updated;
|
||||
registry_->broadcast(bcast, session_id_);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnSession::send_disconnect_and_close(uint32_t code, const std::string& reason) {
|
||||
|
||||
Reference in New Issue
Block a user