This commit is contained in:
2026-09-21 20:30:21 +02:00
parent 73233e9b57
commit 57e4da2ba4
5 changed files with 331 additions and 114 deletions
+42 -2
View File
@@ -4,11 +4,14 @@ mod metrics;
pub mod ws_entrypoint;
use crate::config::NetworkConfig;
use crate::models::channel;
use crate::repositories::Repositories;
use crate::rtc::client::RTCClient;
use crate::services::Services;
use event_bus::EventBus;
use rustrtc::{PeerConnection, RtcConfiguration, RtcConfigurationBuilder};
use std::collections::HashMap;
use std::fmt;
use std::sync::Arc;
// 1. Client crée une RTCPeerConnection
// 2. Client crée une SDP offer
@@ -21,12 +24,44 @@ use std::sync::Arc;
// 9. ICE sélectionne un chemin réseau
// 10. La connexion WebRTC devient active
#[derive(Debug, Clone)]
pub struct VoiceRoom {}
pub struct VoiceRoomManager {
rooms: HashMap<channel::Model, VoiceRoom>,
}
#[derive(Clone)]
pub struct RTCManager {
pub config: RtcConfiguration,
pub repositories: Arc<Repositories>,
pub services: Arc<Services>,
pub event_bus: Arc<EventBus>,
//
rooms: Arc<VoiceRoomManager>,
}
impl fmt::Debug for RTCManager {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VoiceService")
.field("config", &self.config)
// .field("metrics", &self.metrics)
.finish()
}
}
impl VoiceRoom {
pub fn new() -> Self {
Self {}
}
}
impl VoiceRoomManager {
pub fn new() -> Self {
Self {
rooms: HashMap::new(),
}
}
}
impl RTCManager {
@@ -42,16 +77,21 @@ impl RTCManager {
.bind_ip(network.host.to_string());
let config = builder.build();
let rooms = Arc::new(VoiceRoomManager::new());
Self {
config,
repositories,
services,
event_bus,
rooms,
}
}
/// Session Description Protocol - Permet de se mettre d'accord sur les paramètres media
pub async fn handle_sdp_offer(&self, rtc_client: RTCClient, offer_sdp: String) {}
pub async fn handle_sdp_offer(&self, rtc_client: &RTCClient, offer_sdp: String) {
let pc = rtc_client.peer_connection.clone();
}
/// Interactive Connectivity Establishment - Permet de négocier un chemin réseau
pub async fn handle_ice_candidate(&self) {}