Skip to content

Commit

Permalink
Enhance application-only SDP generation
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed May 30, 2024
1 parent 3b826f8 commit 5d2303e
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 5d2303e

Please sign in to comment.