diff --git a/pkg/config/pipeline.go b/pkg/config/pipeline.go index 59dc9649..fde2f0e4 100644 --- a/pkg/config/pipeline.go +++ b/pkg/config/pipeline.go @@ -80,6 +80,7 @@ type SDKSourceParams struct { Identity string TrackSource string TrackKind string + ScreenShare bool AudioInCodec types.MimeType VideoInCodec types.MimeType AudioTrack *TrackSource @@ -302,6 +303,7 @@ func (p *PipelineConfig) Update(request *rpc.StartEgressRequest) error { p.VideoEnabled = true p.VideoDecoding = true p.Identity = req.Participant.Identity + p.ScreenShare = req.Participant.ScreenShare if p.Identity == "" { return errors.ErrInvalidInput("identity") } diff --git a/pkg/pipeline/source/sdk.go b/pkg/pipeline/source/sdk.go index 0a12dde3..1491f006 100644 --- a/pkg/pipeline/source/sdk.go +++ b/pkg/pipeline/source/sdk.go @@ -217,7 +217,7 @@ func (s *SDKSource) awaitParticipantTracks(identity string) (uint32, uint32, err pubs := rp.TrackPublications() expected := 0 for _, pub := range pubs { - if shouldSubscribe(pub) { + if s.shouldSubscribe(pub) { expected++ } } @@ -525,7 +525,7 @@ func (s *SDKSource) onTrackPublished(pub *lksdk.RemoteTrackPublication, rp *lksd return } - if shouldSubscribe(pub) { + if s.shouldSubscribe(pub) { if err := s.subscribe(pub); err != nil { logger.Errorw("failed to subscribe to track", err, "trackID", pub.SID()) } @@ -534,12 +534,12 @@ func (s *SDKSource) onTrackPublished(pub *lksdk.RemoteTrackPublication, rp *lksd } } -func shouldSubscribe(pub lksdk.TrackPublication) bool { +func (s *SDKSource) shouldSubscribe(pub lksdk.TrackPublication) bool { switch pub.Source() { case livekit.TrackSource_CAMERA, livekit.TrackSource_MICROPHONE: - return true + return !s.ScreenShare default: - return false + return s.ScreenShare } }