Browse Source

Emit candidates for bundle offerer-tagged m= section

Paul-Louis Ageneau 3 years ago
parent
commit
6037b8620a
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/description.cpp

+ 7 - 3
src/description.cpp

@@ -180,8 +180,12 @@ string Description::typeString() const { return typeToString(mType); }
 Description::Role Description::role() const { return mRole; }
 
 string Description::bundleMid() const {
-	// Get the mid of the first media
-	return !mEntries.empty() ? mEntries[0]->mid() : "0";
+	// Get the mid of the first non-removed media
+	for (const auto &entry : mEntries)
+		if (!entry->isRemoved())
+			return entry->mid();
+
+	return "0";
 }
 
 optional<string> Description::iceUfrag() const { return mIceUfrag; }
@@ -321,7 +325,7 @@ string Description::generateSdp(string_view eol) const {
 	for (const auto &entry : mEntries) {
 		sdp << entry->generateSdp(eol, addr, port);
 
-		if (std::exchange(first, false)) {
+		if (!entry->isRemoved() && std::exchange(first, false)) {
 			// Candidates
 			for (const auto &candidate : mCandidates)
 				sdp << string(candidate) << eol;