Browse Source

Correctly serialize ExtMap direction to SDP

Asgeir Bjarni Ingvarsson 3 years ago
parent
commit
42bec12129
1 changed files with 19 additions and 1 deletions
  1. 19 1
      src/description.cpp

+ 19 - 1
src/description.cpp

@@ -503,7 +503,25 @@ string Description::Entry::generateSdpLines(string_view eol) const {
 	for (auto it = mExtMap.begin(); it != mExtMap.end(); ++it) {
 		auto &map = it->second;
 
-		sdp << "a=extmap:" << map.id << ' ' << map.uri;
+		sdp << "a=extmap:" << map.id;
+		switch (map.direction) {
+		case Direction::SendOnly:
+			sdp << "/sendonly";
+			break;
+		case Direction::RecvOnly:
+			sdp << "/recvonly";
+			break;
+		case Direction::SendRecv:
+			sdp << "/sendrecv";
+			break;
+		case Direction::Inactive:
+			sdp << "/inactive";
+			break;
+		default:
+			// Ignore
+			break;
+		}
+		sdp << ' ' << map.uri;
 		if (!map.attributes.empty())
 			sdp << ' ' << map.attributes;
 		sdp << eol;