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

Adjustments for BUNDLE group. Update ex_ice. #102

Merged
merged 8 commits into from
Apr 22, 2024
Merged

Adjustments for BUNDLE group. Update ex_ice. #102

merged 8 commits into from
Apr 22, 2024

Conversation

mickel8
Copy link
Member

@mickel8 mickel8 commented Apr 20, 2024

Besides fixes listed below, this PR also update deps and adjusts code to the newest ex_ice.

Fixes:

  • an m-line is only rejected when it has port set to 0 and there is no bundle-only attribute, see here. This is used by Firefox when PC is configured with bundlePolicy: "maxBundle"
  • rejected m-lines are not included in the BUNDLE group, see here
  • in maxBundle policy (the only one we support), candidates are only included in the first m-line, see here. This seems to be true even if the first m-line is stopped in subsequent offers, at least until ICE restart, which I left untouched i.e. we always include candidates in the first mline

Questionable:

  • in maxBundle policy, all mlines but the first one should have bundle-only attribute added, and port in the m-section set to 0, see here. However, there are differences between JSEP RFC, BUNDLE RFC, and browser implementations (see RFC 8829. sec. 1.3 and because of that, we still don't use neither port 0 nor bundle-only attribute

  • depending on the bundle-policy, browsers may send candidates for every m-section, only for the first m-section, or for every type of m-section. There is a question, which candidates we should add to the ICE agent on the answerer side (as we only have one ICE stream and one ICE component) - all of them or only those from the first m-section. Looking at RFC 8829, sec. 5.11:

    If the answer contains valid bundle groups, discard any ICE components for
    the "m=" sections that will be bundled onto the primary ICE components in
    each bundle, and begin muxing these "m=" sections accordingly, as described
    in [RFC8843], Section 7.4.

    so we could take only those candidates that belong to the first m-section as other ICE
    components on the offerer side should be closed anyway. However, because current solution seems to work, I would
    go back to this question once we notice any problems.

  • depending on the rtcpMuxPolicy browsers may generate candidates only for one ICE component (RTP) or for two ICE components (RTP and RTCP) doubling the number of ICE candidates. There is the same question as in the point above, and we do exactly the same thing i.e. we add all candidates regardless of their ICE components.

@mickel8 mickel8 force-pushed the max-bundle branch 2 times, most recently from 6bb1a9a to f5d76ea Compare April 21, 2024 10:23
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

Merging #102 (a45b08a) into master (37db947) will increase coverage by 0.06%.
The diff coverage is 95.00%.

❗ Current head a45b08a differs from pull request most recent head 4f726fc. Consider uploading reports for the commit 4f726fc to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   87.13%   87.20%   +0.06%     
==========================================
  Files          33       33              
  Lines        1625     1626       +1     
==========================================
+ Hits         1416     1418       +2     
+ Misses        209      208       -1     
Files Coverage Δ
lib/ex_webrtc/peer_connection.ex 82.52% <100.00%> (-0.04%) ⬇️
lib/ex_webrtc/peer_connection/configuration.ex 91.66% <ø> (+2.33%) ⬆️
lib/ex_webrtc/sdp_utils.ex 91.72% <92.85%> (-0.46%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37db947...4f726fc. Read the comment docs.

@mickel8 mickel8 force-pushed the max-bundle branch 3 times, most recently from d1c605b to 246eb8a Compare April 21, 2024 11:09
@mickel8 mickel8 force-pushed the max-bundle branch 2 times, most recently from f709e2d to 67944d1 Compare April 21, 2024 11:33
@@ -78,6 +66,26 @@ defmodule ExWebRTC.SDPUtils do
end
end

@spec get_media_direction(ExSDP.Media.t()) ::
:sendrecv | :sendonly | :recvonly | :inactive | nil
def get_media_direction(media) do
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to be close to other get_* functions

Comment on lines 250 to 255
desc_cands =
desc.sdp
|> String.split("\r\n")
|> Enum.find(&String.starts_with?(&1, "a=candidate:"))
|> Enum.filter(&String.starts_with?(&1, "a=candidate:"))

assert desc_cand == cand.candidate
assert ("a=" <> cand.candidate) in desc_cands
Copy link
Member Author

Choose a reason for hiding this comment

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

We no longer can relay on candidates order as they are stored as map in ex_ice

@mickel8 mickel8 marked this pull request as ready for review April 21, 2024 11:35
@mickel8 mickel8 changed the title Adjustments for BUNDLE group Adjustments for BUNDLE group. Update ex_ice. Apr 21, 2024
@mickel8 mickel8 requested a review from LVala April 22, 2024 04:43
@mickel8 mickel8 merged commit 3e9cd55 into master Apr 22, 2024
1 check passed
@mickel8 mickel8 deleted the max-bundle branch April 22, 2024 10:05
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.

None yet

2 participants