Skip to content

Commit

Permalink
Merge pull request paullouisageneau#1199 from paullouisageneau/enhanc…
Browse files Browse the repository at this point in the history
…e-application-sdp

Enhance application-only SDP generation
  • Loading branch information
paullouisageneau committed May 30, 2024
2 parents 0f174a5 + 5d2303e commit 541d646
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/description.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ string Description::generateSdp(string_view eol) const {

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

if (!mIceOptions.empty())
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;
if (mFingerprint)
Expand Down Expand Up @@ -372,28 +371,29 @@ string Description::generateApplicationSdp(string_view eol) const {
const uint16_t port =
cand && cand->isResolved() ? *cand->port() : 9; // Port 9 is the discard protocol

// Session-level attributes
sdp << "a=msid-semantic:WMS *" << eol;
if (!mIceOptions.empty())
sdp << "a=ice-options:" << utils::implode(mIceOptions, ',') << eol;

for (const auto &attr : mAttributes)
sdp << "a=" << attr << eol;

// Application
auto app = mApplication ? mApplication : std::make_shared<Application>();
sdp << app->generateSdp(eol, addr, port);

// Session-level attributes
sdp << "a=msid-semantic:WMS *" << eol;
// Media-level attributes
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)
sdp << "a=fingerprint:"
<< CertificateFingerprint::AlgorithmIdentifier(mFingerprint->algorithm) << " "
<< mFingerprint->value << eol;

for (const auto &attr : mAttributes)
sdp << "a=" << attr << eol;

// Candidates
for (const auto &candidate : mCandidates)
sdp << string(candidate) << eol;
Expand Down

0 comments on commit 541d646

Please sign in to comment.