Browse Source

Fixed message type enum access

Paul-Louis Ageneau 3 years ago
parent
commit
8172f3493d

+ 2 - 2
src/impl/dtlssrtptransport.cpp

@@ -201,7 +201,7 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
 				return;
 				return;
 			}
 			}
 			PLOG_VERBOSE << "Unprotected SRTCP packet, size=" << size;
 			PLOG_VERBOSE << "Unprotected SRTCP packet, size=" << size;
-			message->type = Message::Type::Control;
+			message->type = Message::Control;
 			message->stream = reinterpret_cast<RTCP_SR *>(message->data())->senderSSRC();
 			message->stream = reinterpret_cast<RTCP_SR *>(message->data())->senderSSRC();
 
 
 		} else {
 		} else {
@@ -220,7 +220,7 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
 				return;
 				return;
 			}
 			}
 			PLOG_VERBOSE << "Unprotected SRTP packet, size=" << size;
 			PLOG_VERBOSE << "Unprotected SRTP packet, size=" << size;
-			message->type = Message::Type::Binary;
+			message->type = Message::Binary;
 			message->stream = reinterpret_cast<RTP *>(message->data())->ssrc();
 			message->stream = reinterpret_cast<RTP *>(message->data())->ssrc();
 		}
 		}
 
 

+ 1 - 1
src/impl/sctptransport.cpp

@@ -626,7 +626,7 @@ bool SctpTransport::trySendMessage(message_ptr message) {
 	}
 	}
 
 
 	PLOG_VERBOSE << "SCTP sent size=" << message->size();
 	PLOG_VERBOSE << "SCTP sent size=" << message->size();
-	if (message->type == Message::Type::Binary || message->type == Message::Type::String)
+	if (message->type == Message::Binary || message->type == Message::String)
 		mBytesSent += message->size();
 		mBytesSent += message->size();
 	return true;
 	return true;
 }
 }

+ 5 - 5
src/rtcpreceivingsession.cpp

@@ -46,7 +46,7 @@ static impl::LogCounter COUNTER_BAD_SCTP_STATUS(plog::warning,
 message_ptr RtcpReceivingSession::outgoing(message_ptr ptr) { return ptr; }
 message_ptr RtcpReceivingSession::outgoing(message_ptr ptr) { return ptr; }
 
 
 message_ptr RtcpReceivingSession::incoming(message_ptr ptr) {
 message_ptr RtcpReceivingSession::incoming(message_ptr ptr) {
-	if (ptr->type == impl::Message::Type::Binary) {
+	if (ptr->type == impl::Message::Binary) {
 		auto rtp = reinterpret_cast<const RTP *>(ptr->data());
 		auto rtp = reinterpret_cast<const RTP *>(ptr->data());
 
 
 		// https://tools.ietf.org/html/rfc3550#appendix-A.1
 		// https://tools.ietf.org/html/rfc3550#appendix-A.1
@@ -70,7 +70,7 @@ message_ptr RtcpReceivingSession::incoming(message_ptr ptr) {
 		return ptr;
 		return ptr;
 	}
 	}
 
 
-	assert(ptr->type == impl::Message::Type::Control);
+	assert(ptr->type == impl::Message::Control);
 	auto rr = reinterpret_cast<const RTCP_RR *>(ptr->data());
 	auto rr = reinterpret_cast<const RTCP_RR *>(ptr->data());
 	if (rr->header.payloadType() == 201) {
 	if (rr->header.payloadType() == 201) {
 		// RR
 		// RR
@@ -100,7 +100,7 @@ void RtcpReceivingSession::requestBitrate(unsigned int newBitrate) {
 }
 }
 
 
 void RtcpReceivingSession::pushREMB(unsigned int bitrate) {
 void RtcpReceivingSession::pushREMB(unsigned int bitrate) {
-	message_ptr msg = impl::make_message(RTCP_REMB::SizeWithSSRCs(1), impl::Message::Type::Control);
+	message_ptr msg = impl::make_message(RTCP_REMB::SizeWithSSRCs(1), impl::Message::Control);
 	auto remb = reinterpret_cast<RTCP_REMB *>(msg->data());
 	auto remb = reinterpret_cast<RTCP_REMB *>(msg->data());
 	remb->preparePacket(mSsrc, 1, bitrate);
 	remb->preparePacket(mSsrc, 1, bitrate);
 	remb->setSsrc(0, mSsrc);
 	remb->setSsrc(0, mSsrc);
@@ -109,7 +109,7 @@ void RtcpReceivingSession::pushREMB(unsigned int bitrate) {
 }
 }
 
 
 void RtcpReceivingSession::pushRR(unsigned int lastSR_delay) {
 void RtcpReceivingSession::pushRR(unsigned int lastSR_delay) {
-	auto msg = impl::make_message(RTCP_RR::SizeWithReportBlocks(1), impl::Message::Type::Control);
+	auto msg = impl::make_message(RTCP_RR::SizeWithReportBlocks(1), impl::Message::Control);
 	auto rr = reinterpret_cast<RTCP_RR *>(msg->data());
 	auto rr = reinterpret_cast<RTCP_RR *>(msg->data());
 	rr->preparePacket(mSsrc, 1);
 	rr->preparePacket(mSsrc, 1);
 	rr->getReportBlock(0)->preparePacket(mSsrc, 0, 0, uint16_t(mGreatestSeqNo), 0, 0, mSyncNTPTS,
 	rr->getReportBlock(0)->preparePacket(mSsrc, 0, 0, uint16_t(mGreatestSeqNo), 0, 0, mSyncNTPTS,
@@ -135,7 +135,7 @@ bool RtcpReceivingSession::requestKeyframe() {
 }
 }
 
 
 void RtcpReceivingSession::pushPLI() {
 void RtcpReceivingSession::pushPLI() {
-	auto msg = impl::make_message(RTCP_PLI::Size(), impl::Message::Type::Control);
+	auto msg = impl::make_message(RTCP_PLI::Size(), impl::Message::Control);
 	auto *pli = reinterpret_cast<RTCP_PLI *>(msg->data());
 	auto *pli = reinterpret_cast<RTCP_PLI *>(msg->data());
 	pli->preparePacket(mSsrc);
 	pli->preparePacket(mSsrc);
 	send(msg);
 	send(msg);

+ 1 - 1
src/rtcpsrreporter.cpp

@@ -69,7 +69,7 @@ void RtcpSrReporter::setNeedsToReport() { needsToReport = true; }
 message_ptr RtcpSrReporter::getSenderReport(uint32_t timestamp) {
 message_ptr RtcpSrReporter::getSenderReport(uint32_t timestamp) {
 	auto srSize = RTCP_SR::Size(0);
 	auto srSize = RTCP_SR::Size(0);
 	auto msg = impl::make_message(srSize + RTCP_SDES::Size({{uint8_t(rtpConfig->cname.size())}}),
 	auto msg = impl::make_message(srSize + RTCP_SDES::Size({{uint8_t(rtpConfig->cname.size())}}),
-	                        impl::Message::Type::Control);
+	                              impl::Message::Control);
 	auto sr = reinterpret_cast<RTCP_SR *>(msg->data());
 	auto sr = reinterpret_cast<RTCP_SR *>(msg->data());
 	auto timestamp_s = rtpConfig->timestampToSeconds(timestamp);
 	auto timestamp_s = rtpConfig->timestampToSeconds(timestamp);
 	auto currentTime = timeOffset + timestamp_s;
 	auto currentTime = timeOffset + timestamp_s;

+ 1 - 1
src/websocket.cpp

@@ -66,7 +66,7 @@ bool WebSocket::send(message_variant data) {
 }
 }
 
 
 bool WebSocket::send(const byte *data, size_t size) {
 bool WebSocket::send(const byte *data, size_t size) {
-	return impl()->outgoing(impl::make_message(data, data + size));
+	return impl()->outgoing(impl::make_message(data, data + size, impl::Message::Binary));
 }
 }
 
 
 optional<string> WebSocket::remoteAddress() const {
 optional<string> WebSocket::remoteAddress() const {