Don't require media sections when joining (#4535)

* Don't require media sections when joining

Client except browser (rust/libwebrtc is known) could have problem
to fire ontrack event when reuses extra media section to subscribe
track, so disable this feature in server side and let client determine
if extra media sections are needed.

* lint
This commit is contained in:
cnderrauber
2026-05-20 13:28:51 +08:00
committed by GitHub
parent 019a6640ae
commit 8ab92a80f6
3 changed files with 51 additions and 62 deletions
+50 -54
View File
@@ -80,9 +80,6 @@ const (
PingIntervalSeconds = 5 PingIntervalSeconds = 5
PingTimeoutSeconds = 15 PingTimeoutSeconds = 15
audioSectionsCountWithJoinResponse = 3
videoSectionsCountWithJoinResponse = 3
) )
var ( var (
@@ -177,57 +174,56 @@ type ParticipantParams struct {
PLIThrottleConfig sfu.PLIThrottleConfig PLIThrottleConfig sfu.PLIThrottleConfig
CongestionControlConfig config.CongestionControlConfig CongestionControlConfig config.CongestionControlConfig
// codecs that are enabled for this room // codecs that are enabled for this room
PublishEnabledCodecs []*livekit.Codec PublishEnabledCodecs []*livekit.Codec
SubscribeEnabledCodecs []*livekit.Codec SubscribeEnabledCodecs []*livekit.Codec
Logger logger.Logger Logger logger.Logger
LoggerResolver logger.DeferredFieldResolver LoggerResolver logger.DeferredFieldResolver
Reporter roomobs.ParticipantSessionReporter Reporter roomobs.ParticipantSessionReporter
ReporterResolver roomobs.ParticipantReporterResolver ReporterResolver roomobs.ParticipantReporterResolver
SimTracks map[uint32]interceptor.SimulcastTrackInfo SimTracks map[uint32]interceptor.SimulcastTrackInfo
Grants *auth.ClaimGrants Grants *auth.ClaimGrants
InitialVersion uint32 InitialVersion uint32
ClientConf *livekit.ClientConfiguration ClientConf *livekit.ClientConfiguration
ClientInfo ClientInfo ClientInfo ClientInfo
Region string Region string
Migration bool Migration bool
Reconnect bool Reconnect bool
AdaptiveStream bool AdaptiveStream bool
AllowTCPFallback bool AllowTCPFallback bool
TCPFallbackRTTThreshold int TCPFallbackRTTThreshold int
AllowUDPUnstableFallback bool AllowUDPUnstableFallback bool
TURNSEnabled bool TURNSEnabled bool
ParticipantListener types.LocalParticipantListener ParticipantListener types.LocalParticipantListener
ParticipantHelper types.LocalParticipantHelper ParticipantHelper types.LocalParticipantHelper
DisableSupervisor bool DisableSupervisor bool
ReconnectOnPublicationError bool ReconnectOnPublicationError bool
ReconnectOnSubscriptionError bool ReconnectOnSubscriptionError bool
ReconnectOnDataChannelError bool ReconnectOnDataChannelError bool
VersionGenerator utils.TimedVersionGenerator VersionGenerator utils.TimedVersionGenerator
DisableDynacast bool DisableDynacast bool
SubscriberAllowPause bool SubscriberAllowPause bool
SubscriptionLimitAudio int32 SubscriptionLimitAudio int32
SubscriptionLimitVideo int32 SubscriptionLimitVideo int32
PlayoutDelay *livekit.PlayoutDelay PlayoutDelay *livekit.PlayoutDelay
SyncStreams bool SyncStreams bool
ForwardStats *sfu.ForwardStats ForwardStats *sfu.ForwardStats
DisableSenderReportPassThrough bool DisableSenderReportPassThrough bool
MetricConfig metric.MetricConfig MetricConfig metric.MetricConfig
UseOneShotSignallingMode bool UseOneShotSignallingMode bool
EnableMetrics bool EnableMetrics bool
DataChannelMaxBufferedAmount uint64 DataChannelMaxBufferedAmount uint64
DatachannelSlowThreshold int DatachannelSlowThreshold int
DatachannelLossyTargetLatency time.Duration DatachannelLossyTargetLatency time.Duration
FireOnTrackBySdp bool FireOnTrackBySdp bool
DisableCodecRegression bool DisableCodecRegression bool
LastPubReliableSeq uint32 LastPubReliableSeq uint32
Country string Country string
PreferVideoSizeFromMedia bool PreferVideoSizeFromMedia bool
UseSinglePeerConnection bool UseSinglePeerConnection bool
EnableDataTracks bool EnableDataTracks bool
EnableRTPStreamRestartDetection bool EnableRTPStreamRestartDetection bool
ForceBackupCodecPolicySimulcast bool ForceBackupCodecPolicySimulcast bool
RequireMediaSectionWithJoinResponse bool DisableTransceiverReuseForE2EE bool
DisableTransceiverReuseForE2EE bool
} }
type ParticipantImpl struct { type ParticipantImpl struct {
-4
View File
@@ -67,10 +67,6 @@ func (p *ParticipantImpl) SendJoinResponse(joinResponse *livekit.JoinResponse) e
p.queuedUpdates = nil p.queuedUpdates = nil
p.updateLock.Unlock() p.updateLock.Unlock()
if p.params.RequireMediaSectionWithJoinResponse && p.params.UseSinglePeerConnection {
p.sendMediaSectionsRequirement(audioSectionsCountWithJoinResponse, videoSectionsCountWithJoinResponse)
}
if len(queuedUpdates) > 0 { if len(queuedUpdates) > 0 {
return p.SendParticipantUpdate(queuedUpdates) return p.SendParticipantUpdate(queuedUpdates)
} }
+1 -4
View File
@@ -440,10 +440,7 @@ func newPeerConnection(
} }
} }
lf := pionlogger.NewLoggerFactory(params.Logger) se.LoggerFactory = pionlogger.NewLoggerFactory(params.Logger)
if lf != nil {
se.LoggerFactory = lf
}
ir := &interceptor.Registry{} ir := &interceptor.Registry{}
if params.IsSendSide { if params.IsSendSide {