Browse Source

Merge pull request #371 from stazio/fix_typos

Fixed the description of SDPs and refactor RTP_RTX packets
Paul-Louis Ageneau 4 years ago
parent
commit
d5890ecc05
2 changed files with 10 additions and 11 deletions
  1. 9 3
      include/rtc/rtp.hpp
  2. 1 8
      src/description.cpp

+ 9 - 3
include/rtc/rtp.hpp

@@ -716,16 +716,22 @@ public:
 		return totalSize - (getBody() - reinterpret_cast<char *>(this));
 	}
 
+	[[nodiscard]] size_t getSize()  const{
+		return header.getSize() + sizeof(uint16_t);
+	}
+
 	[[nodiscard]] RTP &getHeader() { return header; }
 
+	/*
+	 * Returns the new size of the packet
+	 */
 	size_t normalizePacket(size_t totalSize, SSRC originalSSRC, uint8_t originalPayloadType) {
 		header.setSeqNumber(getOriginalSeqNo());
 		header.setSsrc(originalSSRC);
 		header.setPayloadType(originalPayloadType);
 		// TODO, the -12 is the size of the header (which is variable!)
-		memmove(header.getBody(), header.getBody() + sizeof(uint16_t),
-		        totalSize - 12 - sizeof(uint16_t));
-		return totalSize - sizeof(uint16_t);
+		memmove(header.getBody(), getBody(), totalSize - getSize());
+		return totalSize - 2;
 	}
 };
 

+ 1 - 8
src/description.cpp

@@ -844,14 +844,7 @@ void Description::Media::addRTPMap(const Description::Media::RTPMap &map) {
 }
 
 std::vector<uint32_t> Description::Media::getSSRCs() {
-	std::vector<uint32_t> vec;
-	for (auto &val : mAttributes) {
-		PLOG_DEBUG << val;
-		if (val.find("ssrc:") == 0) {
-			vec.emplace_back(to_integer<uint32_t>(val.substr(5, val.find(" "))));
-		}
-	}
-	return vec;
+	return mSsrcs;
 }
 
 std::map<int, Description::Media::RTPMap>::iterator Description::Media::beginMaps() {