-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add simulcast sending support #603
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This looks good overall. I left some comments.
In a later PR we should also toy with the idea of creating a new type MidRid
that looks something like:
pub(crate) struct MidRid {
pub(crate) mid: Mid,
pub(crate) rid: Option<Rid>,
}
to see if it would tidy up code to avoid passing around tuples in many places.
I'll leave it to @k0nserv to say whether it's correct to run the pacer per-mid/rid combo. I think it is, but better check with the expert.
I also thought that but just wanted your opinion first - will quickly refactor it |
4b7cc5f
to
23bee70
Compare
I figured since we are adding new code we could switch (or not!) to midrid, and possibly move the stats in another commit if we like it. If we want it in a separate pr, easy enough to pull out |
I turned I also implemented in many more places. I think I'll break the whole |
96b7c97
to
20f27c6
Compare
Heads up: I force pushed a rebase off latest main. |
20f27c6
to
f52fd61
Compare
MidRid refactoring in #604 |
f52fd61
to
800211a
Compare
Didn't mean to elicit a review request with my drive-by comments :D |
All code must be scrutinized! :D |
Say no more! |
d16dfff
to
36e5749
Compare
Yes it's fine. The pacer only uses mid as a lookup key, it could equally use SSRC or this new combo of |
@kc5nra I rebased/squashed commits into two commits. One for the simulcast sending support and one for the VLA serialization. This is how I want this PR to land in main. If we do more work, we can fixup to those two. There are two places I think we need to address before this PR is complete: |
@kc5nra I will now leave this PR in peace (no more force pushing from my side) to let you catch up. |
For https://github.com/algesten/str0m/blob/main/src/change/sdp.rs#L898, you mean something different than this? Though I agree we currently hand wave the active state ad2e78c#diff-5fd5a802394cab016425ddca33d909c07672077403390ccafa359c7d55dcbed0R903-R907 The latter isn't totally necessary for simulcast + VLA (late binding rids to ssrc), but it's 4AM and I'm probably not thinking of all the other permutations |
Go to bed! When we negotiate simulcast with Firefox, we get these rows: There are two (three?) mechanisms at play, and we need to support them all, to some extent.
For incoming simulcast, we should ideally handle 1, but we're currently relying only on 2 because of a bug in FF. For outgoing simulcast I think we should make both 1 and 2 work correctly. |
I'll try to get to this soon - going on a family trip for 4 days. Thanks for the prompt attention and help :-) |
51790eb
to
8c83b27
Compare
Hey @algesten, added a gentle attempt at an implementation to get a discussion started. I wasn't sure the best place to put the idea of forcing the ssrc-group creation, so I just went with one of the possible ways. (Versus a new argument to add_media, etc.) In addition I added an optimization for mid/rid sending that I ran across in libwebrtc that seemed apropos |
8c83b27
to
fb237b9
Compare
Hi @kc5nra, I don't think we need a force_ssrc_group. If we just ensure we allocated SSRC for the simulast layers, we can always send the information as pre-communicated SSRC (case 1). Similarly case 2, we just need to double check we are setting the RTP headers, and always send it. Whether this will trigger a bug in Firefox, we will see, but the ambition is directionally correct :) |
Sounds good - from a publisher to SFU (str0m not acting as the SFU but just the publisher), I was just trying to allow SDP generation of both variants (1) all the SSRCs enumerated + groups (2) just the simulcast and rids. This just allowed it to more closely resemble a libwebrtc offer. Not critical |
Just went down an SDP rabbit hole trying to reason about RID. When the OFFER sends RIDs, I assume we must interpret the intention the same as for PT. I.e. if the direction is If this is consistent with PT logic, it means if the ANSWER contains different RIDs to the OFFER:
It seems reasonable that a side can say "I don't want the high layer". Wonder if there are any specs around this. Bidirectional m-lines. The bane of my life. SDP sucks. |
This is great info, thanks - and your changes make a lot more sense.. I'm still getting a lay of the land! 8853 5.3.2 An answerer that receives an offer with simulcast that lists a number of simulcast streams MAY reduce the number of simulcast streams in the answer, but it MUST NOT add simulcast streams. |
Excellent! Ok. So There are few things to do still:
|
0170ae2
to
36ac2bb
Compare
Rebased off main to get rid of clippy errors. |
0274c7b
to
6067fee
Compare
6067fee
to
aa08d33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're ready to merge
I'll run one round of testing in the morning if we are okay waiting a little bit - how do we want to squash these? And thanks for the attentiveness in this :-) |
@kc5nra I just now squashed all the commits together to the two commits I think we should have. Thanks for persevering through this! I'm fine with waiting to hit merge. Test away! |
Adds support for specifying the RID when writing packets to str0m as well as for serialization of the VLA extended header.
There are a couple points that need to be resolved: