-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix set_remote_description
failing on description with rejected m-lines
#145
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #145 +/- ##
==========================================
+ Coverage 88.31% 88.35% +0.03%
==========================================
Files 36 36
Lines 1891 1897 +6
==========================================
+ Hits 1670 1676 +6
Misses 221 221
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
lib/ex_webrtc/sdp_utils.ex
Outdated
case length(sdp.media) do | ||
0 -> {:error, :empty_sdp} |
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.
[nitpick] Enum.empty?
would work in constant time
lib/ex_webrtc/peer_connection.ex
Outdated
|
||
{ice_ufrag, ice_pwd} -> | ||
:ok = state.ice_transport.set_remote_credentials(state.ice_pid, ice_ufrag, ice_pwd) | ||
end | ||
|
||
for candidate <- SDPUtils.get_ice_candidates(sdp) do |
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 I would move this inside case, when we have ICE credentials, even though that ICE will ignore remote candidates when it does not have them.
Fixes:
set_remote_description
won't try to use ICE credentials from rejected m-lines (and subsequently, won't fail if ICE credentials in rejected m-lines differ from credentials in active m-lines),set_remote_description
won't fail when all of the m-lines are rejected (so there's no valid ICE credentials in the description). In such case, it will either not connect (for the first description) or use credentials from previous descriptions (for the subsequent descriptions)Other elements of rejected m-lines might need to be ignored as well (like MIDs, fingerprints, etc.), but it seems like browsers include them anyway, so for now this fix seems to be enough.
Close #144