diff --git a/include/rtc/peerconnection.hpp b/include/rtc/peerconnection.hpp index e69a436..3a4442b 100644 --- a/include/rtc/peerconnection.hpp +++ b/include/rtc/peerconnection.hpp @@ -52,9 +52,9 @@ using future_certificate_ptr = std::shared_future; struct DataChannelInit { Reliability reliability = {}; - string protocol = ""; bool negociated = false; std::optional id = nullopt; + string protocol = ""; }; class PeerConnection final : public std::enable_shared_from_this { diff --git a/include/rtc/rtc.h b/include/rtc/rtc.h index 071384a..78b9ddd 100644 --- a/include/rtc/rtc.h +++ b/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); diff --git a/src/capi.cpp b/src/capi.cpp index 7029561..a11ad88 100644 --- a/src/capi.cpp +++ b/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); diff --git a/test/connectivity.cpp b/test/connectivity.cpp index 94ac61d..6173fed 100644 --- a/test/connectivity.cpp +++ b/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 received = false;