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

Add ssrc attributes to the SDP #185

Merged
merged 3 commits into from
Jan 17, 2025
Merged

Add ssrc attributes to the SDP #185

merged 3 commits into from
Jan 17, 2025

Conversation

mickel8
Copy link
Member

@mickel8 mickel8 commented Jan 15, 2025

Some implementations still rely on ssrc attributes in SDP offer/answer when demuxing incoming RTP packets (e.g. Pion). While including a=ssrc attribute in the SDP is obsoleted and we should demux by mid, including ssrc is still correct and supported by web browsers.

This PR adds ssrc attributes to the SDP offer/answer when a transceiver is sendonly or sendrecv.

A couple of notes:

  • in theory, if we add a=ssrc:1234 attribute, it should also always has cname attr i.e. a=ssrc:1234 cname:qW34eced (RFC 5567)
  • we don't use cnames so we don't do this. Instead we always add msid attribute as we already have it
  • we stop sending app_data in msid according to what JSEP says (RFC 8829). This app_data does not make any sense anyway as its value is MediaStreamTrack.id, which can change without renegotiation (e.g. when calling rtpsender.replaceTrack)
  • we preallocate ssrc and rtx_ssrc even for recvonly transceivers. This is not fully correct, as ssrc should probably change after transceiver becomes inactive and active again but as far as I understand the code, we haven't been doing this so far anyway
  • we don't add ssrc, ssrcgroup and msid attributes when transceiver is recvonly or inactive
  • relevant rfcs:

@mickel8 mickel8 force-pushed the ssrc branch 2 times, most recently from 82d0d65 to f03b4c2 Compare January 15, 2025 14:31
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.52%. Comparing base (1d09628) to head (fadedd9).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
lib/ex_webrtc/rtp_sender.ex 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   84.56%   84.52%   -0.05%     
==========================================
  Files          49       49              
  Lines        2482     2507      +25     
==========================================
+ Hits         2099     2119      +20     
- Misses        383      388       +5     
Files with missing lines Coverage Δ
lib/ex_webrtc/peer_connection.ex 85.31% <100.00%> (-0.63%) ⬇️
lib/ex_webrtc/rtp_sender/nack_responder.ex 100.00% <100.00%> (ø)
lib/ex_webrtc/rtp_transceiver.ex 90.75% <100.00%> (-0.21%) ⬇️
lib/ex_webrtc/rtp_sender.ex 92.85% <95.65%> (+1.05%) ⬆️

... and 1 file with indirect coverage changes


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 1d09628...fadedd9. Read the comment docs.

Comment on lines +31 to +36
|> Enum.map(fn seq_no ->
{seq_no, Map.get(responder.packets, rem(seq_no, @max_packets))}
end)
|> Enum.filter(fn {seq_no, packet} ->
packet != nil and packet.sequence_number == seq_no
end)
Copy link
Member Author

Choose a reason for hiding this comment

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

🤔

Formatter?

Copy link
Member

@sgfn sgfn left a comment

Choose a reason for hiding this comment

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

As far as I understand the logic, everything looks good 👍 👍 👍

lib/ex_webrtc/rtp_sender.ex Outdated Show resolved Hide resolved
lib/ex_webrtc/rtp_sender.ex Outdated Show resolved Hide resolved
lib/ex_webrtc/rtp_sender.ex Outdated Show resolved Hide resolved
lib/ex_webrtc/peer_connection.ex Outdated Show resolved Hide resolved
Comment on lines +6 to +8
{:ok, pc} = PeerConnection.start_link()
@config PeerConnection.get_configuration(pc)
:ok = PeerConnection.close(pc)
Copy link
Member

Choose a reason for hiding this comment

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

O_O is this even legal

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeap, but acutally I am curious what is the process, peer connection will be linked to 🤔

@mickel8 mickel8 merged commit f87341e into master Jan 17, 2025
3 checks passed
@mickel8 mickel8 deleted the ssrc branch January 17, 2025 11:59
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