forked from versatica/libmediasoupclient
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux demo and native code fixes (versatica#62)
* Fix-up signalling code * Make `SignallingChannel` trait partially async * Use `tokio-tungstenite` once again * Add peer ID to `sig-ack` message as it is now required * Remove some `todo!()` and fix `mediasoupclient-sys` code. * Invoke on_open when WS is connected * Make native callbacks settable at any point * Undo sig-ack changes * Use message-passing architecture to untangle asynchronous mutating callbacks * Closer to equivalence between WASM and Native * Dirty fixing of the event emission for JS * Implement Transport::consume * Fill up some more native stubs * WebRTC MediaStream bindings * Minor fixes - Temporarily disable event emission on native platforms - Fix native "on connect" transport callbacks * Convert Linux demo to a GTK+ app to not have a silly infinite loop (and maybe present the cameras later!) * Align Native and WASM daily-core implementations further - Make WebSocket callbacks registerable in the same order on all targets (e.g. enable registering the callbacks for browser WebSockets before we attempt to open them) - Flesh out more native implementation details in WebRTC * Small tweaks * Update fake_tracks feature * Re-enable participant event emission (still requires action on them) * Prototype C event API * Refactor for code organization * Fix android build * Nuke fake tracks from orbit * Slight cleanup * Partial success at cleaning up the code * Cleanup * Fix clippy warning * Unify stub enumerate_devices * Clippy fix * Fix initial review comments * Clearer names in native WebSocket signaling
- Loading branch information
Showing
249 changed files
with
3,148 additions
and
30,297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[workspace] | ||
members = ["daily-core", "mediasoupclient", "mediasoupclient-sys", "webrtc-sys"] | ||
members = ["daily-core", "mediasoupclient", "mediasoupclient-sys", "webrtc-daily", "webrtc-sys"] | ||
[profile.release] | ||
lto = true # Link-time optimization to enable more places where code can be inlined | ||
#opt-level = 's' # Optimize for size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::{ | ||
collections::HashMap, | ||
sync::{Arc, Mutex}, | ||
}; | ||
|
||
use crate::DailyEvent; | ||
|
||
type Callback = Box<dyn FnMut(Box<dyn std::any::Any + Send>) + Send>; | ||
|
||
#[derive(Default, Clone)] | ||
pub struct EventEmitter { | ||
callbacks: Arc<Mutex<HashMap<DailyEvent, Callback>>>, | ||
} | ||
|
||
impl EventEmitter { | ||
pub fn on(&mut self, event: DailyEvent, callback: Callback) { | ||
self.callbacks.lock().unwrap().insert(event, callback); | ||
} | ||
|
||
pub fn emit(&mut self, event: DailyEvent, data: Box<dyn std::any::Any + Send>) -> bool { | ||
match self.callbacks.lock().unwrap().get_mut(&event) { | ||
Some(cb) => { | ||
cb(data); | ||
true | ||
} | ||
None => false, | ||
} | ||
} | ||
} |
Oops, something went wrong.