Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubscribedQualityUpdate message #270

Merged
merged 11 commits into from Dec 19, 2021
Merged

SubscribedQualityUpdate message #270

merged 11 commits into from Dec 19, 2021

Conversation

boks1971
Copy link
Contributor

@boks1971 boks1971 commented Dec 18, 2021

SubscribedQualityUpdate message to send list of currently subscribed qualities for a simulcast video publisher

"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/webhook"
"github.com/pkg/errors"
Copy link
Contributor Author

@boks1971 boks1971 Dec 18, 2021

Choose a reason for hiding this comment

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

goimports change

secondServerPort = 8880
nodeID1 = "node-1"
nodeID2 = "node-2"
secondServerPort = 8880
Copy link
Contributor Author

@boks1971 boks1971 Dec 18, 2021

Choose a reason for hiding this comment

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

goimports change

@@ -1,3 +1,4 @@
//go:build tools
Copy link
Contributor Author

@boks1971 boks1971 Dec 18, 2021

Choose a reason for hiding this comment

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

goimports change

delete(t.maxSubscriberQuality, subscriberID)
t.maxQualityLock.Unlock()

t.updateQualityChange()
Copy link
Contributor Author

@boks1971 boks1971 Dec 19, 2021

Choose a reason for hiding this comment

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

Wanted to call this from here (and from the routine below) in a go routine, but had a couple of issues

  1. Ordering
  2. Tests. I tried writing tests with the use of goroutine and sync.WaitGroup, but just could not get it to work.

Copy link
Member

@davidzhao davidzhao Dec 19, 2021

Choose a reason for hiding this comment

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

Are you wanting to do so for purposes of deadlocks? The test challenges might be related to the need to lock within the goroutines spun up for testing?

Copy link
Contributor Author

@boks1971 boks1971 Dec 19, 2021

Choose a reason for hiding this comment

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

Yeah mostly for locking purposes. We are not locking here while doing the callback. So, I think we should be fine. I was also generally concerned about the callback having a long call chain and causing problems

@boks1971 boks1971 requested a review from davidzhao Dec 19, 2021
Copy link
Member

@davidzhao davidzhao left a comment

this is great stuff! excited to see this working end to end.

allSubscribersMuted = true
} else {
for _, maxQuality := range t.maxSubscriberQuality {
switch maxSubscribedQuality {
Copy link
Member

@davidzhao davidzhao Dec 19, 2021

Choose a reason for hiding this comment

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

I think we are trying to get the max quality from the values in the map? how about just doing the following?

for _, subQuality := range t.maxSubscriberQuality {
    if subQuality > maxSubscribedQuality {
        maxSubscribedQuality = subQuality
    }
}

Copy link
Contributor Author

@boks1971 boks1971 Dec 19, 2021

Choose a reason for hiding this comment

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

Oh yeah, they are just integers in the end. Will change. Because it is enum, my natural tendency was to think of them as not integers :-)

Copy link
Contributor Author

@boks1971 boks1971 Dec 19, 2021

Choose a reason for hiding this comment

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

Addressed in this commit - 70d443d

@davidzhao
Copy link
Member

@davidzhao davidzhao commented Dec 19, 2021

Thinking out loud, in future optimizations we might want to limit how frequently we are changing the max subscribed layer to clients. i.e. if a group of 3 participants are speaking in a large meeting, we probably don't want to turn off publishing of HQ layers immediately after the larger, speaker view is displaying someone else.

Perhaps some sort of a ramp off time before we turn off the higher layers.

@boks1971
Copy link
Contributor Author

@boks1971 boks1971 commented Dec 19, 2021

Thinking out loud, in future optimizations we might want to limit how frequently we are changing the max subscribed layer to clients. i.e. if a group of 3 participants are speaking in a large meeting, we probably don't want to turn off publishing of HQ layers immediately after the larger, speaker view is displaying someone else.

Perhaps some sort of a ramp off time before we turn off the higher layers.

Yeah, good point. I thought about it too. Could not think of the right balance. Will file an issue and do some more thinking

@boks1971 boks1971 merged commit 1dcc62b into master Dec 19, 2021
2 checks passed
@boks1971 boks1971 deleted the raja_requested_layers branch Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants