Skip to content

Commit 7b45b57

Browse files
Merge pull request #1194 from wcpfeffer/move-session-attr-to-media-level
Migrate session-level attributes to media-level
2 parents d9befcf + 13daa79 commit 7b45b57

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/description.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,7 @@ string Description::generateSdp(string_view eol) const {
310310

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

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

337+
// RFC 8829: Attributes that SDP permits to be at either the session level or the media level
338+
// SHOULD generally be at the media level even if they are identical.
339+
sdp << "a=setup:" << mRole << eol;
340+
if (mIceUfrag)
341+
sdp << "a=ice-ufrag:" << *mIceUfrag << eol;
342+
if (mIcePwd)
343+
sdp << "a=ice-pwd:" << *mIcePwd << eol;
344+
342345
if (!entry->isRemoved() && std::exchange(first, false)) {
343346
// Candidates
344347
for (const auto &candidate : mCandidates)

0 commit comments

Comments
 (0)