~Send initial participant update only after a participant becomes active.~ - General clean up (#3655)

* Send initial participant update only after a participant becomes active.

There are cases where apps send data to remote participant as soon as
client emits `ParticipantConnected`. But, that time point would not have
a fully established client (i. e. the media connection + data channel
establishment is still in progress).

This PR changes the initial participant update to be sent from server
side only when a participant becomes `ACTIVE`, i.e fully connected
(media channel established and data channels open).

It is supported for clients using protocol version > 15.

@cnderrauber bumping up the protocol version in this PR. Move support is
also conditioned on protocol version > 15, but that PR did not ump
protocol version. Please let me know if there are issues bumping
protocol version.

* check for joining states in broadcast

* have to check on other participant

* test

* make helper for sending participant updates

* test

* make utility of pushAndDeque

* test

* consolidate getting other participants

* remove extra cast

* debug

* debug

* typo

* stop transceiver that is not bound

* logs

* log

* check for ever bound

* clean up

* clean up
This commit is contained in:
Raja Subramanian
2025-05-13 14:46:35 +05:30
committed by GitHub
parent 5d4d86f8c5
commit 5172af1526
7 changed files with 238 additions and 174 deletions
+9 -2
View File
@@ -453,9 +453,16 @@ func (t *MediaTrackSubscriptions) downTrackClosed(
// delete the subscribed track only after caching.
if isExpectedToResume {
dt := subTrack.DownTrack()
tr := dt.GetTransceiver()
tr, wasBound := dt.GetTransceiver()
if tr != nil {
sub.CacheDownTrack(subTrack.ID(), tr, dt.GetState())
if wasBound {
sub.CacheDownTrack(subTrack.ID(), tr, dt.GetState())
} else {
// unbound transceivers cannot be re-used as pion will not fire Bind() in
// ReplaceTrack().
t.params.Logger.Infow("stopping unbound transceiver")
tr.Stop()
}
}
}