Skip to content

Include participant_sid in UpdateSubscription. - #279

Merged
boks1971 merged 3 commits into
masterfrom
raja_participant_track_subscription
Dec 23, 2021
Merged

boks1971 merged 3 commits into
masterfrom
raja_participant_track_subscription

Conversation

@boks1971

Copy link
Copy Markdown
Contributor

Prevents all publisher tracks to find a match.

Prevents all publisher tracks to find a match.
@boks1971
boks1971 requested a review from davidzhao December 22, 2021 09:32
Comment thread go.mod Outdated
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
)

replace github.com/livekit/protocol => ../protocol

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update once protocol is merged and versioned.

Comment thread pkg/rtc/room.go
return r.participants[identity]
}

func (r *Room) GetParticipantBySid(participantID string) types.Participant {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooner or later, looks like we will need a fast look up of participant in room by either identity or sid. So, maybe we need to maintain two maps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a identity to sid map makes a ton of sense. and keying off of sid internally.

Comment thread pkg/rtc/room.go
break
}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optimising this a bit by asking participant for specific track sid and breaking as soon as one is found.

Comment thread pkg/rtc/room.go
}

for _, pt := range participantTracks {
p := r.GetParticipantBySid(pt.ParticipantSid)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we need look up room by participant sid.

Comment thread pkg/rtc/room.go
for _, trackSid := range pt.TrackSids {
track := p.GetPublishedTrack(trackSid)
if track != nil {
tracks[trackSid] = track

@boks1971 boks1971 Dec 22, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layering the new field on top and keep building the tracks list.

This is one of the reasons I chose to do the permissions stuff at track level as this is calling AddSubscriber directly on the track. The publishing participant does not have any information about who are all subscribed to its tracks.

@davidzhao davidzhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

Comment thread pkg/rtc/room.go
return r.participants[identity]
}

func (r *Room) GetParticipantBySid(participantID string) types.Participant {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a identity to sid map makes a ton of sense. and keying off of sid internally.

@boks1971
boks1971 merged commit eae6eff into master Dec 23, 2021
@boks1971
boks1971 deleted the raja_participant_track_subscription branch December 23, 2021 03:48
aravindanve pushed a commit to aravindanve/livekit that referenced this pull request Sep 29, 2026
* Include `participant_sid` in `UpdateSubscription`.

Prevents all publisher tracks to find a match.

* generate

* Update protocol version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants