feat: UAC USB microphone passthrough

- Add UAC1 gadget function (ConfigFS) with optimized endpoint config
- Browser mic capture with Opus encoding via WebCodecs AudioEncoder
- WebSocket audio transport (Opus 64kbps, 100x bandwidth reduction vs raw PCM)
- aplay subprocess for reliable PCM playback to USB gadget
- Settings toggle + ActionBar mic button (hidden when UAC disabled)
- Dynamic PCM device resolution (/proc/asound)
- c_chmask=0 + req_number=4 fixes DWC3 composite isochronous endpoint issue
This commit is contained in:
arounyf
2026-07-23 06:56:53 +00:00
parent 4e32b05124
commit e9bed3688f
27 changed files with 977 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ use tower_http::{
use super::audio_ws::audio_ws_handler;
use super::handlers;
use super::uac_ws::uac_audio_ws_handler;
use super::ws::ws_handler;
use crate::auth::auth_middleware;
use crate::hid::websocket::ws_hid_handler;
@@ -100,6 +101,7 @@ pub fn create_router(state: Arc<AppState>) -> Router {
.route("/audio/devices", get(handlers::list_audio_devices))
// Audio WebSocket endpoint
.route("/ws/audio", any(audio_ws_handler))
.route("/ws/uac-audio", any(uac_audio_ws_handler))
// Configuration management (domain-separated endpoints)
.route("/config", get(handlers::config::get_all_config))
.route("/config/video", get(handlers::config::get_video_config))
@@ -278,6 +280,14 @@ pub fn create_router(state: Arc<AppState>) -> Router {
"/otg/network/status",
get(handlers::config::get_otg_network_status),
)
.route(
"/config/uac",
get(handlers::config::get_uac_config),
)
.route(
"/config/uac",
patch(handlers::config::update_uac_config),
)
.route("/msd/status", get(handlers::msd_status))
.route("/msd/images", get(handlers::msd_images_list))
.route("/msd/images/download", post(handlers::msd_image_download))