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 authored and evaldemar committed Jun 7, 2024
1 parent 92e144e commit 1ac7617
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 1ac7617

Please sign in to comment.