Browse Source

Merge branch 'master' into usrsctp-fix-notifications

Paul-Louis Ageneau 5 years ago
parent
commit
eafe86e4c0
6 changed files with 66 additions and 27 deletions
  1. 54 15
      Jamfile
  2. 1 1
      deps/usrsctp
  3. 2 2
      include/rtc/datachannel.hpp
  4. 2 1
      src/description.cpp
  5. 4 5
      src/icetransport.cpp
  6. 3 3
      src/sctptransport.cpp

+ 54 - 15
Jamfile

@@ -20,9 +20,9 @@ lib libdatachannel
 	: # usage requirements
 	<include>./include
 	<library>/libdatachannel//plog
-	<cxxflags>-pthread
-	<toolset>gcc:<cxxflags>"-Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
-	<toolset>clang:<cxxflags>"-Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
+	<toolset>gcc:<cxxflags>"-pthread -Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
+	<toolset>clang:<cxxflags>"-pthread -Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
+	<toolset>msvc:<cxxflags>"-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING"
 	;
 
 feature gnutls : off on : composite propagated ;
@@ -45,7 +45,16 @@ alias usrsctp
     : # no default build
     : # usage requirements
     <include>./deps/usrsctp/usrsctplib
-	<library>libusrsctp.a
+    <library>libusrsctp.a
+    ;
+
+alias usrsctp
+    : # no sources
+    : <toolset>msvc
+    : # no default build
+    : # usage requirements
+    <include>./deps/usrsctp/usrsctplib
+    <library>libusrsctp.lib
     ;
 
 alias juice
@@ -54,35 +63,65 @@ alias juice
     : # no default build
     : # usage requirements
     <include>./deps/libjuice/include
-	<library>libjuice.a
+    <library>libjuice-static.a
+    ;
+
+alias juice
+    : # no sources
+    : <toolset>msvc
+    : # no default build
+    : # usage requirements
+    <include>./deps/libjuice/include
+    <library>libjuice-static.lib
     ;
 
 make libusrsctp.a : : @make_libusrsctp ;
+make libusrsctp.lib : : @make_libusrsctp_msvc ;
+
 actions make_libusrsctp
 {
-	(cd $(CWD)/deps/usrsctp && \
-		./bootstrap && \
-		./configure --enable-static --disable-debug CFLAGS="-fPIC -Wno-address-of-packed-member" && \
-		make)
-    cp $(CWD)/deps/usrsctp/usrsctplib/.libs/libusrsctp.a $(<)
+    (cd $(CWD)/deps/usrsctp && cmake -B build -D CMAKE_C_FLAGS="-fPIC" && cd build && make -j2 usrsctplib-static)
+    cp $(CWD)/deps/usrsctp/build/usrsctplib/libusrsctp.a $(<)
+}
+actions make_libusrsctp_msvc
+{
+    (cd $(CWD)/deps/usrsctp && cmake -B build -G "NMake Makefiles" && cd build && nmake usrsctplib-static)
+    cp $(CWD)/deps/usrsctp/build/usrsctplib/libusrsctp.lib $(<)
 }
 
-make libjuice.a : : @make_libjuice ;
+make libjuice-static.a : : @make_libjuice ;
+make libjuice-static.lib : : @make_libjuice_msvc ;
 
 rule make_libjuice ( targets * : sources * : properties * )
 {
 	if <crypto>gnutls in $(properties)
 	{
-		MAKEOPTS on $(targets) = "USE_NETTLE=1" ;
+		CMAKEOPTS on $(targets) = "-D USE_NETTLE=1" ;
 	}
 	else
 	{
-		MAKEOPTS on $(targets) = "USE_NETTLE=0" ;
+		CMAKEOPTS on $(targets) = "-D USE_NETTLE=0" ;
 	}
 }
 actions make_libjuice
 {
-	(cd $(CWD)/deps/libjuice && make $(MAKEOPTS))
-    cp $(CWD)/deps/libjuice/libjuice.a $(<)
+    (cd $(CWD)/deps/libjuice && cmake -B build -D CMAKE_C_FLAGS="-fPIC" $(CMAKEOPTS) && cd build && make -j2 juice-static)
+    cp $(CWD)/deps/libjuice/build/libjuice-static.a $(<)
+}
+rule make_libjuice_msvc ( targets * : sources * : properties * )
+{
+	if <crypto>gnutls in $(properties)
+	{
+		CMAKEOPTS on $(targets) = "-D USE_NETTLE=1" ;
+	}
+	else
+	{
+		CMAKEOPTS on $(targets) = "-D USE_NETTLE=0" ;
+	}
+}
+actions make_libjuice_msvc
+{
+    (cd $(CWD)/deps/libjuice && cmake -B build -G "NMake Makefiles" $(CMAKEOPTS) && cd build && nmake juice-static)
+    cp $(CWD)/deps/libjuice/build/libjuice-static.lib $(<)
 }
 

+ 1 - 1
deps/usrsctp

@@ -1 +1 @@
-Subproject commit aa10d60bc209028b7dd0370b2d5af9f14051fd23
+Subproject commit fdc4d2b99bc5753c65f12a253d150497b7d5b0f6

+ 2 - 2
include/rtc/datachannel.hpp

@@ -108,8 +108,8 @@ template <typename Iterator> bool DataChannel::sendBuffer(Iterator first, Iterat
 	auto message = std::make_shared<Message>(size);
 	auto pos = message->begin();
 	for (Iterator it = first; it != last; ++it) {
-		auto [bytes, size] = to_bytes(*it);
-		pos = std::copy(bytes, bytes + size, pos);
+		auto [bytes, len] = to_bytes(*it);
+		pos = std::copy(bytes, bytes + len, pos);
 	}
 	return outgoing(message);
 }

+ 2 - 1
src/description.cpp

@@ -113,7 +113,8 @@ Description::Description(const string &sdp, Type type, Role role)
 				if (match_prefix(value, "sha-256 ")) {
 					mFingerprint = value.substr(8);
 					std::transform(mFingerprint->begin(), mFingerprint->end(),
-					               mFingerprint->begin(), [](char c) { return std::toupper(c); });
+					               mFingerprint->begin(),
+					               [](char c) { return char(std::toupper(c)); });
 				} else {
 					PLOG_WARNING << "Unknown SDP fingerprint type: " << value;
 				}

+ 4 - 5
src/icetransport.cpp

@@ -207,7 +207,7 @@ void IceTransport::processCandidate(const string &candidate) {
 
 void IceTransport::processGatheringDone() { changeGatheringState(GatheringState::Complete); }
 
-void IceTransport::StateChangeCallback(juice_agent_t *agent, juice_state_t state, void *user_ptr) {
+void IceTransport::StateChangeCallback(juice_agent_t *, juice_state_t state, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processStateChange(static_cast<unsigned int>(state));
@@ -216,7 +216,7 @@ void IceTransport::StateChangeCallback(juice_agent_t *agent, juice_state_t state
 	}
 }
 
-void IceTransport::CandidateCallback(juice_agent_t *agent, const char *sdp, void *user_ptr) {
+void IceTransport::CandidateCallback(juice_agent_t *, const char *sdp, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processCandidate(sdp);
@@ -225,7 +225,7 @@ void IceTransport::CandidateCallback(juice_agent_t *agent, const char *sdp, void
 	}
 }
 
-void IceTransport::GatheringDoneCallback(juice_agent_t *agent, void *user_ptr) {
+void IceTransport::GatheringDoneCallback(juice_agent_t *, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processGatheringDone();
@@ -234,8 +234,7 @@ void IceTransport::GatheringDoneCallback(juice_agent_t *agent, void *user_ptr) {
 	}
 }
 
-void IceTransport::RecvCallback(juice_agent_t *agent, const char *data, size_t size,
-                                void *user_ptr) {
+void IceTransport::RecvCallback(juice_agent_t *, const char *data, size_t size, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		PLOG_VERBOSE << "Incoming size=" << size;

+ 3 - 3
src/sctptransport.cpp

@@ -262,7 +262,7 @@ bool SctpTransport::send(message_ptr message) {
 		return true;
 
 	mSendQueue.push(message);
-	updateBufferedAmount(message->stream, long(message_size_func(message)));
+	updateBufferedAmount(uint16_t(message->stream), long(message_size_func(message)));
 	return false;
 }
 
@@ -302,7 +302,7 @@ bool SctpTransport::trySendQueue() {
 		if (!trySendMessage(message))
 			return false;
 		mSendQueue.pop();
-		updateBufferedAmount(message->stream, -long(message_size_func(message)));
+		updateBufferedAmount(uint16_t(message->stream), -long(message_size_func(message)));
 	}
 	return true;
 }
@@ -324,7 +324,7 @@ bool SctpTransport::trySendMessage(message_ptr message) {
 		ppid = PPID_CONTROL;
 		break;
 	case Message::Reset:
-		sendReset(message->stream);
+		sendReset(uint16_t(message->stream));
 		return true;
 	default:
 		// Ignore