Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(blink): resend signals to ensure all peers connect #358

Merged
merged 43 commits into from
Nov 13, 2023

Conversation

sdwoodbury
Copy link
Contributor

@sdwoodbury sdwoodbury commented Nov 9, 2023

What this PR does 📖

  • refactors blink (simple_webrtc and host_media were mostly left alone). Most of the logic is now in blink_controller.rs instead of split between the blink implementation, webrtc_controller.rs (removed) and call_initiation.rs (also removed).

the new design made it easy to add the following improvements:

  • when offering a call, the offer signal is resent upon failure.
  • during a call, all participants announce their presence and deterministically initiate webrtc connections by comparing DIDs.

other improvements

  • participants now tell the others when they are recording
  • someone should be able to be offline when a call is offered, turn on the app, and join the call
  • if BlinkImpl is cloned and that clone is dropped, it won't shut down the background tasks anymore.
  • someone should be able to join a call and know who is muted/unmuted/recording. This is done by sending the ParticipantState in the Announce event and removing the other signals. Blink now has an event for ParticipantStateChanged.

Which issue(s) this PR fixes 🔨
Not an issue in Warp but should address the issue where, especially during a group call, not all the participants can hear each other.

Special notes for reviewers 🗒️

Additional comments 🎤

@sdwoodbury sdwoodbury marked this pull request as draft November 9, 2023 20:17
@sdwoodbury sdwoodbury self-assigned this Nov 9, 2023
@sdwoodbury sdwoodbury requested a review from dariusc93 November 9, 2023 21:40
@sdwoodbury sdwoodbury marked this pull request as ready for review November 9, 2023 21:40

impl Drop for NotifyWrapper {
fn drop(&mut self) {
self.notify.notify_waiters();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably check the strong count of the reference so if its the only thing left, it can signal its waiters. Eg

if Arc::strong_count(&self.notify) == 1 {
   self.notify.notify_waiters();
}

Copy link
Contributor Author

@sdwoodbury sdwoodbury Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notify gets cloned and passed to some tasks. I think that dropping NotifyWrapper wouldn't necessarily mean the strong count would be one. I hoped that by putting NotifyWrapper in an Arc, Drop wouldn't be called until all the Arc<NotifyWrapper>s were dropped.

@sdwoodbury sdwoodbury merged commit a20f88f into main Nov 13, 2023
1 check passed
@sdwoodbury sdwoodbury deleted the fix/blink-signaling2 branch November 13, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants