Skip to content

Commit

Permalink
Moves session-level attributes for a=setup, a=ice-ufrag and `a=ic…
Browse files Browse the repository at this point in the history
…e-pwd` to the media-level in `Description::generateSdp(...)`. The goal here is to have better general compatibility as RFC 8829 recommends using the media-level attributes even if the information is identical.
  • Loading branch information
wcpfeffer committed May 27, 2024
1 parent d9befcf commit 13daa79
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/description.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,7 @@ string Description::generateSdp(string_view eol) const {

// Session-level attributes
sdp << "a=msid-semantic:WMS *" << eol;
sdp << "a=setup:" << mRole << eol;

if (mIceUfrag)
sdp << "a=ice-ufrag:" << *mIceUfrag << eol;
if (mIcePwd)
sdp << "a=ice-pwd:" << *mIcePwd << eol;
if (!mIceOptions.empty())
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;
if (mFingerprint)
Expand All @@ -339,6 +334,14 @@ string Description::generateSdp(string_view eol) const {
for (const auto &entry : mEntries) {
sdp << entry->generateSdp(eol, addr, port);

// RFC 8829: Attributes that SDP permits to be at either the session level or the media level
// SHOULD generally be at the media level even if they are identical.
sdp << "a=setup:" << mRole << eol;
if (mIceUfrag)
sdp << "a=ice-ufrag:" << *mIceUfrag << eol;
if (mIcePwd)
sdp << "a=ice-pwd:" << *mIcePwd << eol;

if (!entry->isRemoved() && std::exchange(first, false)) {
// Candidates
for (const auto &candidate : mCandidates)
Expand Down

0 comments on commit 13daa79

Please sign in to comment.