Skip to content

Commit

Permalink
participant screen share (#829)
Browse files Browse the repository at this point in the history
* participant screen share

* fix other call
  • Loading branch information
frostbyte73 authored Dec 18, 2024
1 parent 5e2223b commit f8c92ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions pkg/config/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type SDKSourceParams struct {
Identity string
TrackSource string
TrackKind string
ScreenShare bool
AudioInCodec types.MimeType
VideoInCodec types.MimeType
AudioTrack *TrackSource
Expand Down Expand Up @@ -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")
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/pipeline/source/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}
}
Expand Down Expand Up @@ -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())
}
Expand All @@ -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
}
}

Expand Down

0 comments on commit f8c92ae

Please sign in to comment.