Ver Fonte

Reformatting

Paul-Louis Ageneau há 4 anos atrás
pai
commit
06b46aba91
4 ficheiros alterados com 10 adições e 10 exclusões
  1. 1 1
      include/rtc/peerconnection.hpp
  2. 2 4
      include/rtc/rtc.h
  3. 2 2
      src/capi.cpp
  4. 5 3
      test/connectivity.cpp

+ 1 - 1
include/rtc/peerconnection.hpp

@@ -52,9 +52,9 @@ using future_certificate_ptr = std::shared_future<certificate_ptr>;
 
 struct DataChannelInit {
 	Reliability reliability = {};
-	string protocol = "";
 	bool negociated = false;
 	std::optional<uint16_t> id = nullopt;
+	string protocol = "";
 };
 
 class PeerConnection final : public std::enable_shared_from_this<PeerConnection> {

+ 2 - 4
include/rtc/rtc.h

@@ -106,10 +106,8 @@ typedef struct {
 } rtcDataChannelInit;
 
 typedef void(RTC_API *rtcLogCallbackFunc)(rtcLogLevel level, const char *message);
-typedef void(RTC_API *rtcDescriptionCallbackFunc)(int pc, const char *sdp, const char *type,
-                                                  void *ptr);
-typedef void(RTC_API *rtcCandidateCallbackFunc)(int pc, const char *cand, const char *mid,
-                                                void *ptr);
+typedef void(RTC_API *rtcDescriptionCallbackFunc)(int pc, const char *sdp, const char *type, void *ptr);
+typedef void(RTC_API *rtcCandidateCallbackFunc)(int pc, const char *cand, const char *mid, void *ptr);
 typedef void(RTC_API *rtcStateChangeCallbackFunc)(int pc, rtcState state, void *ptr);
 typedef void(RTC_API *rtcGatheringStateCallbackFunc)(int pc, rtcGatheringState state, void *ptr);
 typedef void(RTC_API *rtcSignalingStateCallbackFunc)(int pc, rtcSignalingState state, void *ptr);

+ 2 - 2
src/capi.cpp

@@ -331,9 +331,9 @@ int rtcAddDataChannelExt(int pc, const char *label, const rtcDataChannelInit *in
 		int dc = emplaceDataChannel(peerConnection->addDataChannel(
 		    string(label ? label : ""),
 		    {.reliability = std::move(r),
-		     .protocol = init && init->protocol ? init->protocol : "",
 		     .negociated = init ? init->negociated : false,
-		     .id = init && init->manualId ? std::make_optional(init->id) : nullopt}));
+		     .id = init && init->manualId ? std::make_optional(init->id) : nullopt,
+		     .protocol = init && init->protocol ? init->protocol : ""}));
 
 		if (auto ptr = getUserPointer(pc))
 			rtcSetUserPointer(dc, *ptr);

+ 5 - 3
test/connectivity.cpp

@@ -212,10 +212,12 @@ void test_connectivity() {
 		throw runtime_error("Second DataChannel is not open");
 
 	// Try to open a negociated channel
-	auto negociated1 = pc1->createDataChannel("negociated", {.negociated = true, .id = 42});
-	auto negociated2 = pc2->createDataChannel("negoctated", {.negociated = true, .id = 42});
+	auto negociated1 =
+	    pc1->createDataChannel("negociated", {.reliability = {}, .negociated = true, .id = 42});
+	auto negociated2 =
+	    pc2->createDataChannel("negoctated", {.reliability = {}, .negociated = true, .id = 42});
 
-	if(!negociated1->isOpen() || !negociated2->isOpen())
+	if (!negociated1->isOpen() || !negociated2->isOpen())
 		throw runtime_error("Negociated DataChannel is not open");
 
 	std::atomic<bool> received = false;