Skip to content

Commit 541d646

Browse files
Merge pull request #1199 from paullouisageneau/enhance-application-sdp
Enhance application-only SDP generation
2 parents 0f174a5 + 5d2303e commit 541d646

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/description.cpp

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

311311
// Session-level attributes
312312
sdp << "a=msid-semantic:WMS *" << eol;
313-
314313
if (!mIceOptions.empty())
315314
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;
316315
if (mFingerprint)
@@ -372,28 +371,29 @@ string Description::generateApplicationSdp(string_view eol) const {
372371
const uint16_t port =
373372
cand && cand->isResolved() ? *cand->port() : 9; // Port 9 is the discard protocol
374373

374+
// Session-level attributes
375+
sdp << "a=msid-semantic:WMS *" << eol;
376+
if (!mIceOptions.empty())
377+
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;
378+
379+
for (const auto &attr : mAttributes)
380+
sdp << "a=" << attr << eol;
381+
375382
// Application
376383
auto app = mApplication ? mApplication : std::make_shared<Application>();
377384
sdp << app->generateSdp(eol, addr, port);
378385

379-
// Session-level attributes
380-
sdp << "a=msid-semantic:WMS *" << eol;
386+
// Media-level attributes
381387
sdp << "a=setup:" << mRole << eol;
382-
383388
if (mIceUfrag)
384389
sdp << "a=ice-ufrag:" << *mIceUfrag << eol;
385390
if (mIcePwd)
386391
sdp << "a=ice-pwd:" << *mIcePwd << eol;
387-
if (!mIceOptions.empty())
388-
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;
389392
if (mFingerprint)
390393
sdp << "a=fingerprint:"
391394
<< CertificateFingerprint::AlgorithmIdentifier(mFingerprint->algorithm) << " "
392395
<< mFingerprint->value << eol;
393396

394-
for (const auto &attr : mAttributes)
395-
sdp << "a=" << attr << eol;
396-
397397
// Candidates
398398
for (const auto &candidate : mCandidates)
399399
sdp << string(candidate) << eol;

0 commit comments

Comments
 (0)