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

Migrate session-level attributes to media-level #1194

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading