todo comment fix screen sharing and video aspect ratio

This commit is contained in:
srtk 2026-02-08 16:53:08 +05:30
parent c644aed661
commit 84d79ab642
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,4 @@
// TODO: Fix screen sharing and video aspect ratio refinements if needed further
use axum::{
extract::ws::{Message, WebSocket},
};
@ -97,6 +98,23 @@ pub async fn handle_socket(mut socket: WebSocket, _addr: SocketAddr, state: AppS
let _ = room.tx.send(control);
}
}
ControlMsg::ChatMessage { message, display_name, .. } => {
// Broadcast chat with sender info
let chat = ControlMsg::ChatMessage {
user_id: uid,
display_name: state.rooms.get(&rid)
.and_then(|r| r.peers.get(&uid).map(|p| p.display_name.clone()))
.unwrap_or(display_name), // Fallback to provided name
message,
timestamp: std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_millis() as u64,
};
if let Some(room) = state.rooms.get(&rid) {
let _ = room.tx.send(chat);
}
}
_ => {}
}
}

View file

@ -21,8 +21,6 @@ pub async fn run_udp_server(state: AppState) -> anyhow::Result<()> {
match socket.recv_from(&mut buf).await {
Ok((len, addr)) => {
let data = &buf[..len];
info!("UDP Recv: {} bytes from {}", len, addr); // Log every packet for debug
// Manually parse header (22 bytes) to match client's raw byte layout:
// Byte 0: version (u8)
@ -57,8 +55,7 @@ pub async fn run_udp_server(state: AppState) -> anyhow::Result<()> {
};
let payload = &data[22..];
info!("UDP: v{} type={:?} user={} len={}", version, media_type, user_id, data.len());
match media_type {
MediaType::Command => {