Initial gui working

This commit is contained in:
joeyahines committed 2026-10-16 18:19:26 -06:00
1 parent 43b1aaa9f7
commit 1ab9260a39
9 files changed
+3615 -103

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
pub mod audio_source_thread;
pub mod tx_thread;
pub mod udp_connection;
pub mod util;
+8 -1
View File
@@ -95,7 +95,14 @@ impl<T: Read + Write> TxThread<T> {
info!("Starting TX Thread...");
loop {
if let Err(err) = self.handle_msg() {
error!("Failed to process message: {err:?}")
match err {
Error::RecvFailed(_err) => {
return;
}
_ => {
error!("Failed to process message: {err:?}")
}
}
}
}
}
+39
View File
@@ -0,0 +1,39 @@
use std::io::{Read, Write};
use std::net::{SocketAddr, UdpSocket};
use std::time::Duration;
#[derive(Debug)]
pub struct OpusUdpConnection {
udp_socket: UdpSocket,
dest: SocketAddr,
}
impl OpusUdpConnection {
pub fn new(src: SocketAddr, dest: SocketAddr) -> Result<Self, std::io::Error> {
Ok(Self {
udp_socket: UdpSocket::bind(src)?,
dest,
})
}
#[allow(dead_code)]
pub fn set_read_timeout(&mut self, timeout: Option<Duration>) -> std::io::Result<()> {
self.udp_socket.set_read_timeout(timeout)
}
}
impl Write for OpusUdpConnection {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.udp_socket.send_to(buf, self.dest)
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
impl Read for OpusUdpConnection {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
self.udp_socket.recv(buf)
}
}