| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-10-21 18:17:43 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-10-21 18:17:43 UTC |
| parent | b280446628b69e373b53596b6e8cf8cf69050447 |
| snikket/jingle/PeerConnection.cpp.hx | +4 | -3 |
| snikket/jingle/Session.hx | +2 | -1 |
diff --git a/snikket/jingle/PeerConnection.cpp.hx b/snikket/jingle/PeerConnection.cpp.hx index 9536b41..acf5c5d 100644 --- a/snikket/jingle/PeerConnection.cpp.hx +++ b/snikket/jingle/PeerConnection.cpp.hx @@ -669,6 +669,7 @@ typedef Configuration = { extern class Description { public function new(sdp: cpp.StdString, sdpType: cpp.Struct<DescriptionType>):Void; public function generateSdp(): StdString; + public function iceUfrag(): StdOptional<StdString>; } @:native("rtc::Candidate") @@ -730,7 +731,7 @@ class PeerConnection { final localCandidateListeners = []; final mainLoop: sys.thread.EventLoop; - public function new(?configuration : Configuration, ?constraints : Dynamic){ + public function new(?configuration : Configuration, ?constraints : Dynamic) { if (Sys.getEnv("SNIKKET_WEBRTC_DEBUG") != null) { untyped __cpp__("rtc::InitLogger(rtc::LogLevel::Verbose);"); } @@ -770,10 +771,10 @@ class PeerConnection { untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread mainLoop.run(() -> { for (cb in localCandidateListeners) { - cb({ candiate: { + cb({ candidate: { candidate: (candidate.candidate() : String), sdpMid: (candidate.mid() : String), - usernameFragment: null // TODO? + usernameFragment: (pc.ref.localDescription().value().iceUfrag().value() : String) }}); } }); diff --git a/snikket/jingle/Session.hx b/snikket/jingle/Session.hx index 974b9e5..1597943 100644 --- a/snikket/jingle/Session.hx +++ b/snikket/jingle/Session.hx @@ -440,7 +440,8 @@ class InitiatedSession implements Session { [ Attribute.parse(candidate.candidate), new Attribute("ice-ufrag", candidate.usernameFragment), - media.attributes.find((attr) -> attr.key == "ice-pwd") + media.attributes.find((attr) -> attr.key == "ice-pwd") ?? + localDescription.attributes.find((attr) -> attr.key == "ice-pwd") ], media.formats ),