mirror of
https://github.com/livekit/livekit.git
synced 2026-11-23 02:29:22 +00:00
rtc: re-use the offered transceiver in one shot signalling on Safari (#5212)
A one shot client, i. e. WHIP, cannot negotiate again. The transceivers of its offer are the only place for a subscribed track. #4474 turned off transceiver re-use for Safari, and the check ran before the one shot branch. The server then added a new transceiver for the subscribed track, which the answer cannot carry. A WHIP client in desktop Safari got a `recvonly` answer and never received the track. The one shot branch now runs first. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb2044e3c9
commit
800d6bfa0f
2 files changed
+25
-4
No files matched your search
@@ -4244,14 +4244,17 @@ func (p *ParticipantImpl) SupportsSyncStreamID() bool {
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) SupportsTransceiverReuse(mt types.MediaTrack) bool {
|
||||
if !p.params.ClientInfo.SupportsTransceiverReuse() {
|
||||
return false
|
||||
}
|
||||
|
||||
// ONE-SHOT-SIGNALLING-MODE: the client cannot negotiate again, so the transceivers of its offer
|
||||
// are the only place for a subscribed track. This holds for every client, also for one that
|
||||
// does not re-use transceivers in regular signalling.
|
||||
if p.params.UseOneShotSignallingMode {
|
||||
return p.ProtocolVersion().SupportsTransceiverReuse()
|
||||
}
|
||||
|
||||
if !p.params.ClientInfo.SupportsTransceiverReuse() {
|
||||
return false
|
||||
}
|
||||
|
||||
return p.ProtocolVersion().SupportsTransceiverReuse() && !p.SupportsSyncStreamID() && (!mt.IsEncrypted() || !p.params.DisableTransceiverReuseForE2EE)
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,24 @@ func TestPublishCodecFallbackSkipsRTX(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestSupportsTransceiverReuse(t *testing.T) {
|
||||
// Browser / Os values are what the server's user agent parser sets for desktop Safari
|
||||
safari := &livekit.ClientInfo{Browser: "Safari", Os: "Mac OS X"}
|
||||
track := &typesfakes.FakeMediaTrack{}
|
||||
|
||||
// a one shot client, i. e. WHIP, cannot negotiate again, so the transceivers of its offer are
|
||||
// the only place for a subscribed track, also on a client that does not re-use otherwise
|
||||
t.Run("one shot signalling re-uses on Safari", func(t *testing.T) {
|
||||
p := newParticipantForTestWithOpts("test", &participantOpts{clientInfo: safari, oneShot: true})
|
||||
require.True(t, p.SupportsTransceiverReuse(track))
|
||||
})
|
||||
|
||||
t.Run("regular signalling does not re-use on Safari", func(t *testing.T) {
|
||||
p := newParticipantForTestWithOpts("test", &participantOpts{clientInfo: safari})
|
||||
require.False(t, p.SupportsTransceiverReuse(track))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSupportsMoving(t *testing.T) {
|
||||
t.Run("current protocol version", func(t *testing.T) {
|
||||
p := newParticipantForTestWithOpts("test", &participantOpts{protocolVersion: types.CurrentProtocol})
|
||||
|
||||
Reference in new issue
Block a user