diff --git a/crates/rutster-media/src/loop_driver.rs b/crates/rutster-media/src/loop_driver.rs index d6b9af6..a9317ea 100644 --- a/crates/rutster-media/src/loop_driver.rs +++ b/crates/rutster-media/src/loop_driver.rs @@ -28,7 +28,7 @@ use std::time::{Duration, Instant}; use str0m::net::Protocol; use str0m::{Input, Output}; -use crate::rtc_session::{RtcSession, IDLE_TIMEOUT}; +use crate::rtc_session::{IDLE_TIMEOUT, RtcSession}; /// 20 ms tick for outbound encoding (matches the PCM frame size, spec §3.9: /// 480 samples @ 24 kHz = 20 ms). On each tick, we pull one frame from the diff --git a/crates/rutster-media/src/rtc_session.rs b/crates/rutster-media/src/rtc_session.rs index a18bdbb..d9dd769 100644 --- a/crates/rutster-media/src/rtc_session.rs +++ b/crates/rutster-media/src/rtc_session.rs @@ -423,7 +423,8 @@ a=candidate:1 1 UDP 2113667327 192.168.1.42 50000 typ host\r use std::time::Duration; let local_addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); - let mut session = RtcSession::new_with_socket(Box::new(FakePackets::new()), local_addr); + let mut session = + RtcSession::new_with_socket(Box::new(FakePackets::new()), local_addr).expect("session"); let _ = session.accept_offer(BROWSER_SDP_OFFER).expect("offer"); let initial_timeouts_fed = session.timeouts_fed; @@ -452,7 +453,7 @@ a=candidate:1 1 UDP 2113667327 192.168.1.42 50000 typ host\r fake.enqueue(&RTP_HEADER_NO_PAYLOAD, stun_src); let local_addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); - let mut session = RtcSession::new_with_socket(Box::new(fake), local_addr); + let mut session = RtcSession::new_with_socket(Box::new(fake), local_addr).expect("session"); let _ = session.accept_offer(BROWSER_SDP_OFFER).expect("offer"); let initial_last_rx = session.last_rx; diff --git a/crates/rutster-tap-echo/src/lib.rs b/crates/rutster-tap-echo/src/lib.rs index 5def304..b665862 100644 --- a/crates/rutster-tap-echo/src/lib.rs +++ b/crates/rutster-tap-echo/src/lib.rs @@ -26,8 +26,8 @@ use std::net::SocketAddr; use futures_util::{SinkExt, StreamExt}; use rutster_tap::protocol::{ - decode_envelope, encode_audio_out, encode_bye, encode_error, encode_hello, DecodedPayload, - HelloPayload, + DecodedPayload, HelloPayload, decode_envelope, encode_audio_out, encode_bye, encode_error, + encode_hello, }; use tokio::sync::oneshot; use tokio::task::JoinHandle; @@ -195,8 +195,8 @@ mod tests { // `PcmFrame` is re-exported by `rutster-tap` from `rutster-media` (spec // §3.1 — one canonical home). Test consumes the re-export rather than // adding `rutster-media` as a second path dep on this crate. - use rutster_tap::protocol::{encode_audio_in, encode_bye, encode_hello}; use rutster_tap::PcmFrame; + use rutster_tap::protocol::{encode_audio_in, encode_bye, encode_hello}; #[tokio::test] async fn echo_round_trips_one_audio_frame() { diff --git a/crates/rutster-tap/src/lib.rs b/crates/rutster-tap/src/lib.rs index 5006c89..0bc7b44 100644 --- a/crates/rutster-tap/src/lib.rs +++ b/crates/rutster-tap/src/lib.rs @@ -36,15 +36,15 @@ pub mod tap_client; // future brains) get it from one canonical home (spec §3.1). pub use rutster_media::PcmFrame; -pub use metrics::{MetricsSnapshot, TapMetrics, TAP_PLAYOUT_FRAMES}; +pub use metrics::{MetricsSnapshot, TAP_PLAYOUT_FRAMES, TapMetrics}; pub use protocol::{ - decode_envelope, decode_pcm, encode_audio_in, encode_audio_out, encode_bye, encode_error, - encode_hello, encode_pcm, encode_session_end, AudioPayload, DecodedFrame, DecodedPayload, - Envelope, ErrorPayload, FrameKind, HelloPayload, Payload, ReasonPayload, SessionEndPayload, - TapProtoError, PROTOCOL_VERSION, SAMPLES_PER_FRAME as WIRE_SAMPLES_PER_FRAME, + AudioPayload, DecodedFrame, DecodedPayload, Envelope, ErrorPayload, FrameKind, HelloPayload, + PROTOCOL_VERSION, Payload, ReasonPayload, SAMPLES_PER_FRAME as WIRE_SAMPLES_PER_FRAME, + SessionEndPayload, TapProtoError, decode_envelope, decode_pcm, encode_audio_in, + encode_audio_out, encode_bye, encode_error, encode_hello, encode_pcm, encode_session_end, }; pub use tap_audio_pipe::TapAudioPipe; -pub use tap_client::{run_tap_client, TapClientError}; +pub use tap_client::{TapClientError, run_tap_client}; #[cfg(test)] mod tests { diff --git a/crates/rutster-tap/src/metrics.rs b/crates/rutster-tap/src/metrics.rs index 90c7e8e..b0a1e73 100644 --- a/crates/rutster-tap/src/metrics.rs +++ b/crates/rutster-tap/src/metrics.rs @@ -8,8 +8,8 @@ //! cheapest. A snapshot read is taken at log time (e.g. once per second or //! on tap-disconnect). -use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; /// Bounded playout ring capacity (spec §4.1: 5 frames = 100 ms at 20 ms/frame). /// Tunable *constant* (no runtime config in slice-2; a future-rung concern). diff --git a/crates/rutster-tap/src/tap_audio_pipe.rs b/crates/rutster-tap/src/tap_audio_pipe.rs index 67c4463..91e2bd9 100644 --- a/crates/rutster-tap/src/tap_audio_pipe.rs +++ b/crates/rutster-tap/src/tap_audio_pipe.rs @@ -18,14 +18,14 @@ //! manual `push_back_bounded` policy is the smallest structure that fits. use std::collections::VecDeque; -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use rutster_media::{AudioSink, AudioSource, PcmFrame}; use tokio::sync::mpsc; use tracing::{debug, trace}; -use crate::metrics::{TapMetrics, TAP_PLAYOUT_FRAMES}; +use crate::metrics::{TAP_PLAYOUT_FRAMES, TapMetrics}; pub struct TapAudioPipe { // Core → brain (inbound decoded PCM from peer): @@ -226,7 +226,7 @@ mod tests { let (tx_pcm_in, _rx_pcm_in, tx_audio_out, rx_audio_out, metrics) = channels(); let mut pipe = TapAudioPipe::new(tx_pcm_in, rx_audio_out, metrics); drop(tx_audio_out); // close the engine→playout-ring direction - // Now next_pcm_frame should return None (silence) — Disconnected path. + // Now next_pcm_frame should return None (silence) — Disconnected path. assert!(pipe.next_pcm_frame().is_none()); } } diff --git a/crates/rutster-tap/src/tap_client.rs b/crates/rutster-tap/src/tap_client.rs index 6cdc91b..4700d95 100644 --- a/crates/rutster-tap/src/tap_client.rs +++ b/crates/rutster-tap/src/tap_client.rs @@ -23,8 +23,8 @@ //! would need a fresh oneshot — breaking the model where the binary holds //! one close signal per session that survives across reconnects. -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use std::time::{Duration, Instant}; use futures_util::{SinkExt, StreamExt}; @@ -32,14 +32,14 @@ use rutster_call_model::ChannelId; use rutster_media::PcmFrame; use thiserror::Error; use tokio::sync::{mpsc, oneshot}; -use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::WebSocketStream; +use tokio_tungstenite::tungstenite::Message; use tracing::{debug, info, trace, warn}; use crate::metrics::TapMetrics; use crate::protocol::{ - decode_envelope, encode_audio_in, encode_hello, encode_session_end, DecodedPayload, - TapProtoError, + DecodedPayload, TapProtoError, decode_envelope, encode_audio_in, encode_hello, + encode_session_end, }; #[derive(Debug, Error)] diff --git a/crates/rutster/src/routes.rs b/crates/rutster/src/routes.rs index 58e0970..c9210b2 100644 --- a/crates/rutster/src/routes.rs +++ b/crates/rutster/src/routes.rs @@ -10,7 +10,7 @@ //! No authn/authz, no TLS, no multi-tenancy — all deferred per spec §1.2. use axum::extract::{Path, State}; -use axum::http::{header, StatusCode}; +use axum::http::{StatusCode, header}; use axum::response::{IntoResponse, Response}; use axum::routing::{get, post}; use axum::{Json, Router}; diff --git a/crates/rutster/src/session_map.rs b/crates/rutster/src/session_map.rs index dfc7f3b..54d7929 100644 --- a/crates/rutster/src/session_map.rs +++ b/crates/rutster/src/session_map.rs @@ -38,7 +38,7 @@ use rutster_media::{RtcSession, RtcSessionError}; use tokio::sync::Mutex; use tracing::{debug, info, warn}; -use crate::tap_engine::{spawn_tap_engine, TapConn}; +use crate::tap_engine::{TapConn, spawn_tap_engine}; /// The per-session wrapper struct (slice-2, spec §6). /// diff --git a/crates/rutster/src/tap_engine.rs b/crates/rutster/src/tap_engine.rs index ad0b372..bf2d5f8 100644 --- a/crates/rutster/src/tap_engine.rs +++ b/crates/rutster/src/tap_engine.rs @@ -24,13 +24,13 @@ //! channel ends the loop_driver touches indirectly through `AudioSource`/ //! `AudioSink`). -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use std::time::Duration; use futures_util::FutureExt; use rutster_call_model::ChannelId; -use rutster_tap::tap_client::{run_tap_client, TapClientError}; +use rutster_tap::tap_client::{TapClientError, run_tap_client}; use rutster_tap::{TapAudioPipe, TapMetrics}; use tokio::sync::{mpsc, oneshot}; use tokio::task::JoinHandle; @@ -390,7 +390,7 @@ mod tests { assert_eq!(b.next_delay(), Duration::from_secs(1)); // step 3 assert_eq!(b.next_delay(), Duration::from_secs(2)); // step 4 assert_eq!(b.next_delay(), Duration::from_secs(5)); // step 5: cap - // Cap invariant: stays at 5s forever (infinite retries, per spec §5.2). + // Cap invariant: stays at 5s forever (infinite retries, per spec §5.2). assert_eq!(b.next_delay(), Duration::from_secs(5)); // step 6 assert_eq!(b.next_delay(), Duration::from_secs(5)); // step 7 assert_eq!(b.next_delay(), Duration::from_secs(5)); // step 8+