wip: dual audio transmission server

This commit is contained in:
Kingtous
2022-11-03 21:09:37 +08:00
parent e0f73ccc28
commit 28ad271693
3 changed files with 80 additions and 1 deletions

View File

@@ -29,6 +29,13 @@ use service::{GenericService, Service, Subscriber};
use service::ServiceTmpl;
use crate::ipc::{connect, Data};
pub use service::{GenericService, Service, ServiceTmpl, Subscriber};
use std::{
collections::HashMap,
net::SocketAddr,
sync::{Arc, Mutex, RwLock, Weak},
time::Duration,
};
pub mod audio_service;
cfg_if::cfg_if! {
@@ -65,6 +72,13 @@ type ConnMap = HashMap<i32, ConnInner>;
lazy_static::lazy_static! {
pub static ref CHILD_PROCESS: Childs = Default::default();
pub static ref CONN_COUNT: Arc<Mutex<usize>> = Default::default();
// A client server used to provide local services(audio, video, clipboard, etc.)
// for all initiative connections.
//
// [Note]
// Now we use this [`CLIENT_SERVER`] to do following operations:
// - record local audio, and send to remote
pub static ref CLIENT_SERVER: ServerPtr = new();
}
pub struct Server {
@@ -316,6 +330,13 @@ impl Server {
}
}
}
// get a new unique id
pub fn get_new_id(&mut self) -> i32 {
let new_id = self.id_count;
self.id_count += 1;
new_id
}
}
impl Drop for Server {