todo comment fix screen sharing and video aspect ratio
This commit is contained in:
parent
c644aed661
commit
84d79ab642
2 changed files with 19 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
// TODO: Fix screen sharing and video aspect ratio refinements if needed further
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::ws::{Message, WebSocket},
|
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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ pub async fn run_udp_server(state: AppState) -> anyhow::Result<()> {
|
||||||
Ok((len, addr)) => {
|
Ok((len, addr)) => {
|
||||||
let data = &buf[..len];
|
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:
|
// Manually parse header (22 bytes) to match client's raw byte layout:
|
||||||
// Byte 0: version (u8)
|
// Byte 0: version (u8)
|
||||||
// Byte 1: media_type (u8)
|
// Byte 1: media_type (u8)
|
||||||
|
|
@ -58,7 +56,6 @@ pub async fn run_udp_server(state: AppState) -> anyhow::Result<()> {
|
||||||
|
|
||||||
let payload = &data[22..];
|
let payload = &data[22..];
|
||||||
|
|
||||||
info!("UDP: v{} type={:?} user={} len={}", version, media_type, user_id, data.len());
|
|
||||||
|
|
||||||
match media_type {
|
match media_type {
|
||||||
MediaType::Command => {
|
MediaType::Command => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue