ion-sfu icon indicating copy to clipboard operation
ion-sfu copied to clipboard

Not all relayed tracks received due to race condition

Open fffilimonov opened this issue 2 years ago • 0 comments

Your environment.

  • Version: daf197ada794c66ab01b7fe4e32718cbc4dba005
  • Client: daf197ada794c66ab01b7fe4e32718cbc4dba005
  • Environement: macOS
  • Are you using a TURN server? no

What did you do?

Trying to relay tracks between 2 ion-sfu

What did you expect?

Tracks relayed

What happened?

I do:

Peer.Publisher().Relay(...)
session.AddRelayPeer(peerID string, signalData []byte) ([]byte, error)

sometimes first relayed track from SFU1 not received on SFU2

I found the root cause: SFU1 call createRelayTrack after OnOpen event for dataChannel created between SFU1 and SFU2
it leads to sending message via dataChannel to SFU2 with ion_relay_request for this track
sometimes SFU2 receives message ion_relay_request from dataChannel before OnOpen fired on SFU2 and NewRelayPeer called it leads to calling receive with no onTrack handlers set

As I understand OnOpen for dataChannel on SFU1 side and OnOpen on SFU2 not synchronized.

fffilimonov avatar Dec 21 '22 18:12 fffilimonov