Prechádzať zdrojové kódy

H265RtpDepacketizer: Include payload type when creating FrameInfo

This follows the API change in #1156 and is based on
the very similar change to H264RtpDepacketizer (commit
e9060bf3a39cbc0b1264e5db0c903a1a2164972b).
Robert Edmonds 1 rok pred
rodič
commit
2773d01678

+ 1 - 1
include/rtc/h265rtpdepacketizer.hpp

@@ -39,7 +39,7 @@ private:
 
 	void addSeparator(binary& accessUnit);
 	message_vector buildFrames(message_vector::iterator firstPkt, message_vector::iterator lastPkt,
-	                           uint32_t timestamp);
+	                           uint8_t payloadType, uint32_t timestamp);
 };
 
 } // namespace rtc

+ 6 - 3
src/h265rtpdepacketizer.cpp

@@ -57,10 +57,11 @@ void H265RtpDepacketizer::addSeparator(binary& accessUnit)
 }
 
 message_vector H265RtpDepacketizer::buildFrames(message_vector::iterator begin,
-                                                message_vector::iterator end, uint32_t timestamp) {
+                                                message_vector::iterator end,
+                                                uint8_t payloadType, uint32_t timestamp) {
 	message_vector out = {};
 	auto accessUnit = binary{};
-	auto frameInfo = std::make_shared<FrameInfo>(timestamp);
+	auto frameInfo = std::make_shared<FrameInfo>(payloadType, timestamp);
 	auto nFrags = 0;
 
 	for (auto it = begin; it != end; ++it) {
@@ -154,6 +155,7 @@ void H265RtpDepacketizer::incoming(message_vector &messages, const message_callb
 	               messages.end());
 
 	while (mRtpBuffer.size() != 0) {
+		uint8_t payload_type = 0;
 		uint32_t current_timestamp = 0;
 		size_t packets_in_timestamp = 0;
 
@@ -162,6 +164,7 @@ void H265RtpDepacketizer::incoming(message_vector &messages, const message_callb
 
 			if (current_timestamp == 0) {
 				current_timestamp = p->timestamp();
+				payload_type = p->payloadType(); // should all be the same for data of the same codec
 			} else if (current_timestamp != p->timestamp()) {
 				break;
 			}
@@ -176,7 +179,7 @@ void H265RtpDepacketizer::incoming(message_vector &messages, const message_callb
 		auto begin = mRtpBuffer.begin();
 		auto end = mRtpBuffer.begin() + (packets_in_timestamp - 1);
 
-		auto frames = buildFrames(begin, end + 1, current_timestamp);
+		auto frames = buildFrames(begin, end + 1, payload_type, current_timestamp);
 		messages.insert(messages.end(), frames.begin(), frames.end());
 		mRtpBuffer.erase(mRtpBuffer.begin(), mRtpBuffer.begin() + packets_in_timestamp);
 	}