Skip to content

Conversation

WofWca
Copy link
Member

@WofWca WofWca commented Sep 20, 2025

TODO:

  • Merge the base branch into main, such that only 2 commits remain.

- Add `iceCandidatePoolSize` to prefetch ICE candidates
  before `setLocalDescription`.
- Instantiate `RTCPeerConnection` sooner,
  don't wait for `getUserMedia()` to resolve.

I have checked that this does indeed make us prepare
the local offer faster by ~150ms.
That is 300ms in total (per side).

This commit also refactors the `CallsManager`
by removing the `init()` method and moving its code
into the constructor.
This also helps us initialize it synchronously,
which thus I have replaced `useEffect` with `useMemo`
and moved the manager to inside the `App` component.

Related: #10.
window.calls.endCall();
}

onFailed() {
Copy link
Member Author

@WofWca WofWca Sep 20, 2025

Choose a reason for hiding this comment

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

Note that hypothetically this function can get called, for example, on a second startCall invokation, which would not be quite correct. After the connection has been first established, we should fail only if the connection itself fails terminally.

In such a case, we'd show the "failed" screen, but still keep sending the video to the remote party, without the user knowing it.

};

this.peerConnection.onconnectionstatechange = () => {
if (this.peerConnection.connectionState === "failed") {
Copy link
Member Author

@WofWca WofWca Sep 20, 2025

Choose a reason for hiding this comment

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

Wait, it looks like this is not the terminal state? Based on my tests, the connection can still recover, without iceRestart().

https://w3c.github.io/webrtc-pc/#dfn-connectionstate

}

onFailed() {
console.log("onFailed, ending the call soon.");
Copy link
Member Author

Choose a reason for hiding this comment

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

Update comment.

@WofWca WofWca marked this pull request as draft September 20, 2025 15:59
@WofWca WofWca force-pushed the wofwca/async-getIceServers branch 2 times, most recently from 09c0e24 to d726836 Compare September 23, 2025 18:02
Base automatically changed from wofwca/async-getIceServers to main September 24, 2025 17:25
@adbenitez
Copy link
Member

this needs to be rebased now

@adbenitez
Copy link
Member

postponing this, closing for now to have a more clear view of what is really wanted and needing review

@adbenitez adbenitez closed this Oct 1, 2025
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