Refactor the imp/gui bondary to use real traits #18

Merged
liamwarfield merged 8 commits from gui-platform-boundary-refactor into main 2026-02-18 04:53:41 +00:00
3 changed files with 13 additions and 7 deletions
Showing only changes of commit 5f3466546e - Show all commits
-4
View File
2
@@ -6,10 +6,6 @@ use mumble_web2_common::{ClientConfig, ServerStatus};
use std::collections::HashMap;
use std::time::Duration;
// ============================================================================
// Platform Struct
// ============================================================================
/// Desktop platform implementation using Tokio and native audio.
liamwarfield marked this conversation as resolved Outdated
Outdated
Review

Delete this bar

Delete this bar
pub struct DesktopPlatform;
+1 -1
View File
@@ -45,7 +45,7 @@ impl super::PlatformInterface for MobilePlatform {
}
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
get_status(client).await
super::connect::get_status(client).await
}
fn init_logging() {
+12 -2
View File
@@ -15,10 +15,15 @@ use std::time::Duration;
// Trait Definitions
// ============================================================================
/// Platform-specific audio subsystem for capturing microphone input and creating playback streams.
liamwarfield marked this conversation as resolved Outdated
Outdated
Review

We need to add a doc comment for the overall trait here.

We need to add a doc comment for the overall trait here.
Outdated
Review

Done

Done
///
/// The audio system handles Opus encoding internally - callers receive encoded frames
/// ready for network transmission.
pub trait AudioSystemInterface: Sized {
/// The player type returned by [`create_player`](Self::create_player).
type AudioPlayer: AudioPlayerInterface;
/// Initialize the audio system, including relevant state
/// Initialize the audio system.
async fn new() -> Result<Self, Error>;
/// Set the processor for the microphone input, mainly noise cancellation settings.
@@ -35,8 +40,13 @@ pub trait AudioSystemInterface: Sized {
fn create_player(&mut self) -> Result<Self::AudioPlayer, Error>;
}
/// A handle to an active audio playback stream for a single remote user.
///
/// Each connected user gets their own `AudioPlayer` instance, which decodes
/// incoming Opus frames and outputs PCM audio to the platform's audio device.
/// The player manages its own decoder state and output buffer.
pub trait AudioPlayerInterface {
/// Playback an opus frame.
/// Decode and play an Opus-encoded audio frame.
fn play_opus(&mut self, payload: &[u8]);
}