Code Monkey home page Code Monkey logo

webrtc-native's Introduction

GDNative WebRTC plugin for Godot

Getting Started

Download latest binary version GitHub

Compiling

Clone this repository with the following command to checkout all the dependencies: godot-cpp, openssl and libdatachannel (and sub-dependencies).

$ git clone --recurse-submodules https://github.com/godotengine/webrtc-native.git

If you already checked out the branch use the following commands to update the dependencies:

$ git submodule update --init --recursive

Compiling the extension.

To build the GDExtension version of the plugin (Godot 4.1+) run the following command from the webrtc-native folder:

$ scons platform=<your platform>

This will build all the required dependencies into a single shared library.

To build the "legacy" GDExtension version of the plugin (Godot 4.0) run the following command instead:

$ scons platform=<your platform> godot_version=4.0

To build the GDNative version of the plugin (Godot 3.x) run the following command instead:

$ scons platform=<your platform> godot_version=3

Replace <your platform> with either windows, linux, osx, android, or ios.

Include target=release or target=debug for release or debug build (default is debug).

The resulting library and associated tres or gdextension will be created in bin/[extension|gdnative]/webrtc[_debug] depending on the target and godot_version.

You simply need to copy that folder to the root folder of your project. Note that you will have to build the library for all the desired export platforms.

License

The webrtc-native plugin is licensed under the MIT license (see LICENSE), while libdatachannel and its dependencies are licensed under other permissive open source licences. Please see thirdparty/README.md for more informations.

webrtc-native's People

Contributors

brandonmakin avatar dsnopek avatar faless avatar jonathanpicques avatar marksort avatar rondao avatar ughuuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webrtc-native's Issues

Performance issues under poor network conditions

Godot version

3.3.4.stable

Plugin version

0.5

System information

Windows 10, Linux Mint 20.2

Issue description

Under poor network conditions (high latency and packet loss), WebRTCMultiplayer causes frame rate issues in the Godot engine. The issue seems to manifest itself on nodes that are receiving packets. Using NetworkedMultiplayerENet under these conditions does not have the issue. I was able to reproduce the issue on both Windows and Linux.

2021-10-29.15-10-25.mp4

Steps to reproduce

  • Establish a connection between two peers using WebRTCMultiplayer.
  • Simulate latency and packet loss
    • I used Clumsy on Windows to set latency to 400ms and packet loss to 25%, but I also had the issue occurring at 250ms latency and 2% packet loss
    • I was also able to reproduce on Linux using tc

Minimal reproduction project

WebRTC Performance Issue.zip

RPC calls failing when integrating webrtc-native into bomber-rtc project

In prototyping multiplayer with Godot, I originally had an example working that was based off of the bomberman example codebase doing NAT punchthrough with a rendezvous server using Godot's ENet implementation. However, after doing some research and realizing how naive my implementation was, and not wanting to dive into implementing ICE on top of ENet (just yet), I figured it was worthwhile seeing if WebRTC would serve my purposes.

Using a combination of the godot-example-project's webrtc-signaling example, @Faless 's bomber-rtc example, webrtc-native, and my existing codebase, I went to work of transitioning everything over to WebRTC. For what it's worth, I'm currently testing with 3.2.3-stable, and have four different machines interacting:

  • Windows 10 (local)
  • Ubuntu 20.04 LTS (local)
  • OSX 10.14.5 (local)
  • Ubuntu 20.04 LTS (digital ocean droplet running headless)

The issues I have seem to stem from having more than two peers connecting. I went through a pretty lengthy process of trying different combinations of systems being the "host" (for what that means in the webrtc sense with server_compatibility = true), with and without the non local headless instance to determine if it was an issue with ICE/NAT punchthrough.

The issues I have always seemed to come up when the ICE candidate process had completed, and connected_ok was called from gamestate.gd. I've greatly simplified gamestate, essentially halting it from moving on to the register_player calls, as this was what was failing, occasionally. Instead, after receiving connected_ok, I have each of the "clients" starting a loop of sending rpc calls that just sends a string with ping+n, where n is an incrementing number. What ends up happening is that the other connected clients, as well as the server should receive:

ping+1
ping+2
ping+3
ping+4
ping+5
ping+6
...  

Instead, what happens is that occasionally one of these rpc calls seems to get dropped, and instead of ping+n, I'll just get a blank newline written to the debug log, like this:

ping+1
ping+2
ping+3

ping+5
ping+6
...  

The drops seem random, and just because the drop seems to happen on one receiver (be it another client, or the server), another receiver won't necessarily miss the same call, which leads me to believe there is something happening on the webrtc-native rpc reception side that's causing the miss.

The reason I've narrowed this down to webrtc-native is because last night I went through and generated HTML5 exports on the 3 local machines in order to utilize the same webrtc high level multiplayer code base, but not use webrtc-native, and I have not been able to recreate the issue once. I probably ran ~20 iterations, and was switching back and forth between HTML5 and native export, with the native always failing a few times in sending 25 ping rpc calls following connected_ok.

I understand this is a pretty large wall of text. I certainly can put together a reproducible test if someone else has at least three separate machine that can do HTML5 and native tests, if need be, but I figured it was worthwhile to post my findings and get a conversation going first.

WebRtcPeerConnection is failing half the time on C#

Godot version

4.1

Plugin version

1.0.2

System information

Windows

Issue description

When creating my WebRtcPeerConnection this error occurs. It sometimes stops the connection its very spotty on if it actually stops the connection from happening. This does not occure on the GD script side of it.

the code im using is
in steps to reproduce

The error

E 0:00:09:0657 Godot.NativeInterop.NativeFuncs.generated.cs:115 @ void Godot.NativeInterop.NativeFuncs.godotsharp_internal_tie_native_managed_to_unmanaged(IntPtr , IntPtr , Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.godot_bool ): Condition "_instance_bindings != nullptr" is true.
<C++ Source> core/object/object.cpp:1750 @ set_instance_binding()
Godot.NativeInterop.NativeFuncs.generated.cs:115 @ void Godot.NativeInterop.NativeFuncs.godotsharp_internal_tie_native_managed_to_unmanaged(IntPtr , IntPtr , Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.godot_bool )
InteropUtils.cs:60 @ void Godot.NativeInterop.InteropUtils.TieManagedToUnmanaged(Godot.GodotObject , IntPtr , Godot.StringName , Boolean , System.Type , System.Type )
GodotObject.base.cs:40 @ void Godot.GodotObject._ConstructAndInitialize(IntPtr , Godot.StringName , System.Type , Boolean )
WebRtcPeerConnection.cs:105 @ Godot.WebRtcPeerConnection..ctor()
Client.cs:91 @ void Client.createPeer(Int32 )
Client.cs:67 @ void Client._Process(Double )
Node.cs:2087 @ Boolean Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
Client_ScriptMethods.generated.cs:115 @ Boolean Client.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant** , Int32 , Godot.NativeInterop.godot_variant_call_error* , Godot.NativeInterop.godot_variant* )

Steps to reproduce

I created the signaling server and the connection and it blows up
private void createPeer(int id){
if(id != peer.GetUniqueId()){
WebRtcPeerConnection connection = new WebRtcPeerConnection();

		Godot.Collections.Dictionary config = new Godot.Collections.Dictionary {
			["iceServers"] = new Godot.Collections.Array {
				new Godot.Collections.Dictionary {
				["urls"] = new Godot.Collections.Array {
						"stun:stun.l.google.com:19302"
					}
				}
			}
		};
		
		connection.Initialize(config);

		connection.SessionDescriptionCreated += (type, sdp) => offerCreated(type, sdp, id);
		connection.IceCandidateCreated += (media, index, name) => iceCandidateCreated(media, index, name, id);
		rtcPeer.AddPeer(connection, id);

		if(id < peer.GetUniqueId()){
			connection.CreateOffer();
		}
	}
}

Minimal reproduction project

The project is located on my github if you wish to test it
https://github.com/finepointcgi/WebRTC-With-Godot-Tutorial-cSharp/tree/developer-bug-report

Godot 4.0 beta 5 crashes when loading extension

Godot version

4.0 beta 5

Plugin version

v1.0.0-beta4 - Libdatachannel 0.17.10+git

System information

Pop!_OS 22.04 LTS

Issue description

I'm attempting to use the WebRTC GDNative Extension with the webrtc_signaling example with Godot 4.0 beta 5.

At first, I could open the project but the extension wouldn't load, citing that the object files included with the extension were missing from ~/.local/share/lib/. After copying the files included in godot-extension-webrtc/lib into that directory and closing the editor, I can no longer open the project at all. Instead, I get this error:


================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta5.official (89a33d28f00fec579184fb7193790d40aa09b45b)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f150ea42520] (??:0)
[2] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x429d7e8] (??:0)
[3] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x43e433b] (??:0)
[4] godot::String::init_bindings() (??:0)
[5] godot::Variant::init_bindings() (??:0)
[6] godot::GDExtensionBinding::init(GDNativeInterface const*, void*, GDNativeInitialization*) (??:0)
[7] /home/ben/.local/share/applications/../lib/libwebrtc_native.linux.template_debug.x86_64.so(webrtc_extension_init+0x5d) [0x7f1508be4e3d] (??:0)
[8] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x42b69b1] (??:0)
[9] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x431a436] (??:0)
[10] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x402f792] (??:0)
[11] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x4042599] (??:0)
[12] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x408f11f] (??:0)
[13] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0x4318146] (??:0)
[14] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0xd9dd29] (??:0)
[15] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f150ea29d90] (??:0)
[16] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f150ea29e40] (??:0)
[17] /home/ben/.local/share/applications/Godot_v4.0-beta5_linux.x86_64() [0xdbe18e] (??:0)
-- END OF BACKTRACE --
================================================================
[1]    30336 IOT instruction (core dumped)  ~/.local/share/applications/Godot_v4.0-beta5_linux.x86_64 project.godot

(I've also made an issue on the main Godot repo because I wasn't totally sure where the problem might be)

Steps to reproduce

  1. Unzip the provided project files
  2. Copy contents of godot-extension-webrtc/lib to ~/.local/share/lib
  3. Attempt to open project with Godot 4.0 beta 5

Minimal reproduction project

webrtc_signaling_w_extension.zip

0.3 Plugin error: 'WebRTCDataChannel' is not a valid type in Win 10 Godot Engine v3.1.1.stable

After importing plugin zip into an empty project folder WebRTCNativeDemo I get error:

Godot Engine v3.1.1.stable.official (c) 2007-2019 Juan Linietsky, Ariel Manzur & Godot Contributors.
res://scripts/SimplePeer.gd:42 - Parse Error: Identifier 'WebRTCDataChannel' is not a valid type (not a script or class), or could not be found on base 'self'.
modules/gdscript/gdscript.cpp:580 - Method/Function Failed, returning: ERR_PARSE_ERROR
Switch Scene Tab

Am I missing something? Sorry I'm new to using Godot 3.1.1 let alone to using GDNative.
Will I even need the WebRTC plugin if switching to Godot 3.2 Alpha 2 then?

The SConstruct does not work for osx platform

Godot version

3.4.4-stable

Plugin version

master

System information

MacOS, M2

Issue description

scons platform=osx target=release -j6 arch=arm64

errors with

clang: error: no such file or directory: 'deps/build/osx.release.arm64.dir/libdatachannel/libdatachannel-static.a'
clang: error: no such file or directory: 'deps/build/osx.release.arm64.dir/libdatachannel/deps/libjuice/libjuice-static.a'
clang: error: no such file or directory: 'deps/build/osx.release.arm64.dir/libdatachannel/deps/libsrtp/libsrtp2.a'
clang: error: no such file or directory: 'deps/build/osx.release.arm64.dir/libdatachannel/deps/usrsctp/usrsctplib/libusrsctp.a'

scons platform=osx target=release -j6

errors with

scons: *** [deps/build/osx.release.universal.dir/openssl/libssl.a] ValueError : macOS architecture not supported: universal

scons platform=osx target=release -j6 arch=x86_64

errors with

clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/libdatachannel/libdatachannel-static.a'
clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/libdatachannel/deps/libjuice/libjuice-static.a'
clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/libdatachannel/deps/libsrtp/libsrtp2.a'
clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/libdatachannel/deps/usrsctp/usrsctplib/libusrsctp.a'
clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/openssl/libssl.a'
clang: error: no such file or directory: 'deps/build/osx.release.x86_64.dir/openssl/libcrypto.a'

Steps to reproduce

run the above commands

Minimal reproduction project

No response

Library allows add_peer() when connection_state is not WebRTCPeerConnection.STATE_NEW.

Godot version

3.3.3.stable

Plugin version

0.5

System information

Linux

Issue description

According to the documentation for add_peer, the following should not have worked:

if v["subject"] == "offer":
	var peer = WebRTCPeerConnection.new()
	peer.initialize({"iceServers": [ { "urls": ["stun:stun.l.google.com:19302"] } ] })
	peer.connect("session_description_created", self, "client_session_description_created")
	peer.connect("ice_candidate_created", self, "client_ice_candidate_created")

	var networkedmultiplayerclient = WebRTCMultiplayer.new()
	peer.set_remote_description("offer", v["data"])
	networkedmultiplayerclient.add_peer(peer, 1)

However, it does in the webrtc-native library. But it doesn't in the HTML5 implementation. This difference made my bug quite hard to find.

Basically my last two lines needed to be swapped around for it to be right.

Steps to reproduce

The code above is an excerpt of the client_packet_received from here:
https://github.com/goatchurchprime/godot_multiplayer_networking_workbench/blob/main/networking/WebRTCmultiplayerclient.gd#L29

It would take a bit of work to thin it down to just that WebRTCmultiplayerclient example. It would be easy to show if there was a minimal WebRTC multiplayer example in the networking demo projects, and to keep it self-contained it could use WebSockets as the signalling system

Minimal reproduction project

See above

ICE exchange does not work properly when a native client creates an offer to a browser

Godot version

4.1.3.stable.official

Plugin version

v1.0.3

System information

Windows 11

Issue description

This was already posted here.
Deleted because it wasn't a bug, it was PEBKAC.

The ICE exchange seems to work fine with native-to-native clients. It also works when the browser calls the create_offer method and exchanges with a native client.

However, the ICE exchange does not work when the native client calls the create_offer method and exchanges it with a browser client. The same happens with browser-to-browser ICE exchanges as well.

I know nothing about how the ICE exchange works, so I'm just relying on what the server logs are printing.

Native-to-native ICE exchange:

server sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=rtc 3720359899 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS *\r\na=setup:actpass\r\na=ice-ufrag:8Fwn\r\na=ice-pwd://rsvLKicpvi5121cj4BFf\r\na=ice-options:ice2,trickle\r\na=fingerprint:sha-256 90:7D:3A:C2:1D:02:D5:1C:56:A1:C3:BC:E8:16:4C:14:F8:DD:DE:8E:68:60:50:16:D5:E2:57:D4:E0:C6:50:0D\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=mid:0\r\na=sendrecv\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n","type":"offer"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 2122317823 LOCAL_IP 50825 typ host"}

client sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=rtc 3574127925 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS *\r\na=setup:active\r\na=ice-ufrag:shmG\r\na=ice-pwd:/DNWIlsirTHNf7D19t9VN5\r\na=ice-options:ice2,trickle\r\na=fingerprint:sha-256 F9:C4:3C:7B:E5:BE:90:43:A4:CB:52:0F:C8:ED:B7:EA:7D:27:4B:DD:0D:D4:E2:1E:42:34:B9:CF:28:5F:26:5F\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=mid:0\r\na=sendrecv\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n","type":"answer"}
client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 2122317823 LOCAL_IP 50827 typ host"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:3 1 UDP 1686109695 PUBLIC_IP 50825 typ srflx raddr 0.0.0.0 rport 0"}
client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:2 1 UDP 1686109951 PUBLIC_IP 50827 typ srflx raddr 0.0.0.0 rport 0"}

Browser-to-native ICE exchange (browser calls create_offer):

server sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 4820537007877044315 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 B8:3E:53:3F:80:97:26:DC:AB:3A:14:83:5E:BF:FA:74:9B:C5:4B:3D:6F:8B:50:8E:0F:92:FE:B2:F7:64:F8:6C\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:c2012f35316d7ddf8003dfb3b50197e0\r\na=ice-ufrag:efc32a9d\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n","type":"offer"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:0 1 UDP 2122252543 740e96d7-c7ba-49c5-877d-a9198be5737d.local 55873 typ host"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:2 1 TCP 2105524479 740e96d7-c7ba-49c5-877d-a9198be5737d.local 9 typ host tcptype active"}
client sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=rtc 1812742799 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS *\r\na=setup:active\r\na=ice-ufrag:MNIr\r\na=ice-pwd:DP0PfkbSNdLPqVBmMAebEX\r\na=ice-options:ice2,trickle\r\na=fingerprint:sha-256 55:C3:07:EF:55:DE:08:9B:83:5B:B1:12:9C:74:F2:75:FD:CF:DB:40:C8:F8:1C:42:B0:B7:6A:1A:BF:9E:BA:3C\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=mid:0\r\na=sendrecv\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n","type":"answer"}
client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 2122317823 LOCAL_IP 55875 typ host"}
client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:2 1 UDP 1686109951 PUBLIC_IP 55875 typ srflx raddr 0.0.0.0 rport 0"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 1686052863 PUBLIC_IP 55873 typ srflx raddr 0.0.0.0 rport 0"}

Native-to-browser ICE exchange (native calls create_offer):

server sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=rtc 4254617398 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS *\r\na=setup:actpass\r\na=ice-ufrag:ubR7\r\na=ice-pwd:vac2KQQMKexeI9RuLPcUyw\r\na=ice-options:ice2,trickle\r\na=fingerprint:sha-256 35:31:5F:95:8A:35:82:17:89:BC:20:62:A1:8E:73:B5:ED:FE:37:AA:8D:13:71:67:D2:4C:32:E2:5E:B5:7B:68\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=mid:0\r\na=sendrecv\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n","type":"offer"}
server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 2122317823 LOCAL_IP 50773 typ host"}

client sent {"cmd":"setup_webrtc_session","sdp":"v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 4212232542675602986 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 20:20:02:B2:E4:50:BF:03:0C:86:67:8C:71:42:6D:F6:77:CA:F3:77:D7:70:15:C6:DF:F4:CC:AA:99:55:B3:89\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:af2c222b3842cd2ebd7cab2fda0e00a9\r\na=ice-ufrag:fde2a9b1\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n","type":"answer"}


server sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:2 1 UDP 1686109951 PUBLIC_IP 50773 typ srflx raddr 0.0.0.0 rport 0"}

In the native-to-browser scenario, after the client (browser) sets up its session, it does not send these packets:

client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:1 1 UDP 2122317823 LOCAL_IP 55875 typ host"}
client sent {"cmd":"add_ice_candidate","index":0,"media":"0","name":"candidate:2 1 UDP 1686109951 PUBLIC_IP 55875 typ srflx raddr 0.0.0.0 rport 0"}

Is this something that the webrtc plugin does, or is this something the built-in browser WebRTC capabilities handle? Is this intended functionality in the browser?

Steps to reproduce

  • Download and install the Go compiler
  • Download the WebRTC GDExtension
  • Extract the webrtc folder into the root of the project.
  • Start the dedicated server by running go build ; ./webrtc-test-server in the server folder.
  • Open the Godot project and run the HTML5 export to the server/static directory.
  • Open a browser to http://localhost:8080 (the websocket will fail to upgrade if you use 127.0.0.1),
  • Run a native client.
  • In the browser client, enter a server name and click Host. In the native client, enter the same server name and click Connect. It should succeed and the two clients can talk to each other.
  • Now refresh the browser and restart the native client, but this time, host in the native client and connect in the browser. The WebRTC ICE exchange does not complete and the browser and native client cannot talk to each other.

Minimal reproduction project

webrtc-godot.zip

Problem with Higl Level Multiplayer Api

Godot version

4.0 beta2

Plugin version

latest for 4.0 beta2

System information

Windows 11

Issue description

WebRtc is working strange, and maybe there are bugs in case of high level multiplayer api.

I tried to check bomber-rpc demo, but it has lobby stage and starts the game only after lobby sealing. But I want to make a game, when clients can connect and disconnect any time. I have working project based on Enet peers, and now want to migrate to WebRTC.

First issue that I see - rpc() call is trying to use peer, that is not connected. I tried to send rpc call only to peers, that has connection status - connected, and it worked. But only for first two clients. I think, that something is happening when new client is connecting and there is going some offer-candidate-ice magic.

Steps to reproduce

I added repro project, based on signalling demo. Just launch exported project at least 3 times. Choose one server - it will have signalling server) and other clients. And you will see errors like:

E 0:00:14:0718 _send_rpc: DataChannel is closed
<C++ Source> src/WebRTCLibDataChannel.cpp:211 @ _put_packet()
client.gd:23 @ _send_rpc()

E 0:00:14:0719 _send_rpc: Method/function failed. Returning: FAILED
<C++ Source> src/WebRTCLibDataChannel.cpp:212 @ _put_packet()
client.gd:23 @ _send_rpc()

Minimal reproduction project

No response

Segfault when TURN server is added as a candidate

Stack:

Connected 495950498
Peer connected 1, error
(opensslidentity.cc:45): Making key pair
(peerconnection.cc:849): Session: 2587601506333643374 is destroyed.
(opensslidentity.cc:93): Returning key pair
(opensslcertificate.cc:58): Making certificate for WebRTC
(opensslcertificate.cc:105): Returning certificate
(peerconnection.cc:849): Session:  is destroyed.
ERROR: PeerConnection could not be created
ERROR: peer_connection.get() == nullptr
ERROR: add_peer: Condition "p_peer->get_connection_state() != WebRTCPeerConnection::STATE_NEW" is true. Returned: ERR_INVALID_PARAMETER
   At: modules/webrtc/webrtc_multiplayer.cpp:242.
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3c3e0) [0x7fafbc5753e0] (??:0)
[2] godot_webrtc::WebRTCLibPeerConnection::close() (??:0)
[3] godot_webrtc::WebRTCLibPeerConnection::~WebRTCLibPeerConnection() (??:0)
[4] void godot::_godot_class_destroy_func<godot_webrtc::WebRTCLibPeerConnection>(void*, void*, void*) (??:0)
[5] godot() [0x26016ed] (??:?)
[6] godot() [0xc6af00] (??:0)
[7] godot() [0x291f269] (??:?)
[8] godot() [0xa0d558] (??:0)
[9] godot() [0xbf8599] (??:0)
[10] godot() [0xb385d6] (??:0)
[11] godot() [0x2a0b35b] (??:?)
[12] godot() [0x2a29818] (??:?)
[13] godot() [0xc4e60f] (??:0)
[14] godot() [0xc57fc6] (??:0)
[15] godot() [0xc58ed7] (??:0)
[16] godot() [0xbd8eff] (??:0)
[17] godot() [0xc4e6d3] (??:0)
[18] godot() [0xb38596] (??:0)
[19] godot() [0x2a0b35b] (??:?)
[20] godot() [0x2a29818] (??:?)
[21] godot() [0xc4e60f] (??:0)
[22] godot() [0xc57fc6] (??:0)
[23] godot() [0xc58fc0] (??:0)
[24] godot() [0x278631e] (??:?)
[25] godot() [0x26fa0f6] (??:?)
[26] godot() [0x2786799] (??:?)
[27] godot() [0x28ea179] (??:?)
[28] godot() [0xc4e6d3] (??:0)
[29] godot() [0xb38596] (??:0)
[30] godot() [0x2a0b35b] (??:?)
[31] godot() [0x2a29740] (??:?)
[32] godot() [0x18c4a6f] (??:0)
[33] godot() [0xbd90b4] (??:0)
[34] godot() [0x186bb0e] (??:0)
[35] godot() [0x18a419e] (??:0)
[36] godot() [0x2949ee0] (??:?)
[37] godot() [0x8582dd] (??:0)
[38] /usr/lib/libc.so.6(__libc_start_main+0xf2) [0x7fafbc560002] (??:0)
[39] godot() [0x86695e] (??:0)
-- END OF BACKTRACE --

v1.0.0-alpha1 for godot3 for windows instead of dll files are so files at lib folder, and not working at godot 3.4.4 after renaming to dll

Godot version

v3.4.4.stable.official [419e713a2]

Plugin version

1.0.0-alpha1

System information

Windows 10

Issue description

webrtc plugin v1.0.0-alpha1 for godot3 for windows instead of dll files are so files at lib folder, and not working at godot 3.4.4 after renaming .so to .dll

Steps to reproduce

Try to starts any godot3 windows progect with webrtc plugin 1.0.0-alpha1 e.g. at godot editor.

Minimal reproduction project

No response

iOS and Android target?

Is there any idea for iOS and Android? Is it not in consideration or something long story to implement?

Error loading custom built library on Linux ("undefined symbol: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev")

There's a change I want to test to the gdnative plugin, so I'm building it myself. FYI, I haven't made my change yet, I'm just building it unchanged first to make sure I can do it.

I followed the instructions in the README.md (I used the pre-built webrtc binaries from godotengine/webrtc-actions) and successfully built a binary.

However, when I replace the pre-built version I was using previously with the one I built, I get this error when starting my game:

E 0:00:00.309   open_dynamic_library: Can't open dynamic library: /home/dsnopek/games/Retro Tank Party/webrtc/lib/libwebrtc_native.linux.release.64.so. Error: /home/dsnopek/games/Retro Tank Party/webrtc/lib/libwebrtc_native.linux.release.64.so: undefined symbol: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev
  <C++ Error>   Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
  <C++ Source>  drivers/unix/os_unix.cpp:415 @ open_dynamic_library()

Any ideas?

I built the gdnative plugin with GCC, which is also what I used to build Godot itself.

Thanks in advance!

Apple Silicon library missing

Godot version

3.4 beta6

Plugin version

0.5

System information

OSX 11.6

Issue description

Error reported by Godot:

E 0:00:00.126 open_dynamic_library: Can't open dynamic library: /Users/andrewgeorgiades/webrtc test/webrtc/lib/libwebrtc_native.osx.release.64.dylib, error: dlopen(/Users/andrewgeorgiades/webrtc test/webrtc/lib/libwebrtc_native.osx.release.64.dylib, 2): no suitable image found. Did find:
/Users/andrewgeorgiades/webrtc test/webrtc/lib/libwebrtc_native.osx.release.64.dylib: mach-o, but wrong architecture
/Users/andrewgeorgiades/webrtc test/webrtc/lib/libwebrtc_native.osx.release.64.dylib: mach-o, but wrong architecture.
<C++ Error> Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
<C++ Source> platform/osx/os_osx.mm:1916 @ open_dynamic_library()

Steps to reproduce

  1. Add webrtc folder to project.
  2. Run empty project to see error

Minimal reproduction project

No response

Make builds for major and minor releases

Godot version

4.0.0, 4.0.1, 4.0.2, 3.5.2, etc.

Plugin version

latest

System information

All

Issue description

It would be nice to have the builds for major and minor releases of Godot 4 (also 3).
We are making a plugin that requires WebRTC on all supported platforms and well, that requires the builds for each platform.
To my understanding there is already a build script, but still requires some manual work for upload.

Steps to reproduce

N/A

Minimal reproduction project

N/A

Difficulty compiling on Windows - /MD vs /MT

Firstly, my C++ skills are very rusty (last used it about 10 years ago for any actual development work) and I'm not experienced at all in these builds systems, so if I missed something obvious please say so.

Building Linux and Android binaries on a 64 bit Linux host went relatively smoothly, though I did have to dig around in the godot-cpp pull requests, issues and commit history in order to find a build config that worked.

On a Windows host, building Windows binaries, I struggled a lot and eventually succeeded.

The precompiled libwebrtc-full binaries don't seem to work when compiling webrtc-native for and on Windows, with the complaint that a static release library doesn't match to the dynamic release target. So, I though I'd compile libwebrtc myself.

Since the linked script from the readme doesn't seem to work any more (fails to sync from google), I ended up following the instructions from Microsoft up to "Downloading the bits" (ie syncing the branch with gclient), then copying in the build/util scripts and tools from the webrtc-builds repo, modifying them to properly work with VS2017, and eventually getting a working build - only to find that they, too, were statically linked and didn't work on a dynamic target. The specific error was:

error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

warning LNK4098: defaultlib โ€˜LIBCMTโ€™ conflicts with use of other libs; use /NODEFAULTLIB:library

Given that the build targets for the godot-cpp and webrtc-native projects seemed to be explicitly using the /MD and /MDd linker options, I tried to see if I could build webrtc using the /MD flag - it seems this isn't possible as the project explicitly ignores the is_component_build, with a Google engineer basically saying "well whatever project you're building with should support a /MT binary", which wasn't too helpful.

Finally I did the obvious thing and changed the godot-cpp and webrtc-native scripts for Windows linkage to use /MT and /MTd instead, whereupon the build worked and I got a binary out of the thing. I'm just wondering if I've set myself up for some unexpected behaviour by doing so, though the gdnative dll seems to work.

All in all - wondering if there are any changes here worth making a pull request for, or investigating further.

Can't establish a communication in NakamaWebRTC project

Godot version

4.1, 4.1.1

Plugin version

webrtc-native v1.0.1, NakamaAPI v3.3.1

System information

Widows 10

Issue description

Hi to all,
Tried to make https://gitlab.com/snopek-games/godot-nakama-webrtc David Snopek's Nakama WebRTC project on Godot4, But Unfortunately Peers won't connect not even on local LAN, and getting this error:
OnlineMatch.gd:586 @ _webrtc_connect_peer(): Condition "network_mode == MODE_NONE" is true. Returning: ERR_UNCONFIGURED.
Asked @dsnopek himself for help and also decided to share it here too.
After many hours of debugging found an only one condition which establishes connection:
1.run two instances of project we're gonna call them 1 and 2
2.create a match in 1 and try to join with 2 which 1 and 2 won't get connected.
3.don't quit the instances and press the X button on 1 which will force both instances to get back to "MatchScreen".
4.this time without quitting, create a match with 2 and try to join with 1 which in result both instances will get connected.

Steps to reproduce

1.Download the project from GitLab from given link in the description.
2.Replace the webrtc-native module proper version.
3.run your nakama server (has to be 3.15 version or lower ones, unless with latest version (3.16) project will crash).
4.start at least two instances and try to create a match with one and join with other one.
it will stuck an connecting.

Minimal reproduction project

https://drive.google.com/file/d/1L9sv9q5HEmAzrHRvdrKb4yXow1W0THSw/view?usp=sharing

Can't load WebRTC native plugin on the Mac

Godot version

4.1.1

Plugin version

Latest Official Build

System information

Mac OS 13.3.1 (Ventura) M1 PRO

Issue description

I tried the official webrtc demo project.

Downloaded the native webrtc plugin and copied to root folder of the project.

On Debug start there is an error: Error loading extension: res://webrtc.gdextension

Steps to reproduce

Unpack the sample and put official libs to lib folder in the project.
Run the project on Mac M1.

Minimal reproduction project

sample-rtc-project.zip

NixOS error: libstdc++.so.6: cannot open shared object file: No such file or directory

There is an issue on NixOS with the libstdc++.so

This is what it does on startup for me.

Editing project: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal
ERROR: Can't open dynamic library: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so. Error: libstdc++.so.6: cannot open shared object file: No such file or directory
   at: open_dynamic_library (drivers/unix/os_unix.cpp:447)
ERROR: GDExtension dynamic library not found: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so
   at: open_library (core/extension/gdextension.cpp:400)
ERROR: Failed loading resource: res://webrtc/webrtc.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:222)
ERROR: Error loading extension: res://webrtc/webrtc.gdextension

(Why is it taking the debug library and not the release version? Does this mean my version of Godot has been compiled as a debug, so this is the compatible one?)

I hacked it so it worked by following @MatthewCroughan's method above:

$ nix build github:nixos/nixpkgs/nixos-unstable#gcc-unwrapped.lib

$ readlink -f result-lib/lib64/libstdc++.so.6
/nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30

$ patchelf --replace-needed libstdc++.so.6 /nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30 ./libwebrtc_native.linux.template_debug.x86_64.so

$ ldd libwebrtc_native.linux.template_debug.x86_64.so
linux-vdso.so.1 (0x00007ffc346fb000)
	/nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30 (0x00007ffa3caa4000)
	libm.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libm.so.6 (0x00007ffa3c9c4000)
	libgcc_s.so.1 => /nix/store/0fvh2p4irz0lw0cpy2ll1rf2hbhbym3g-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x00007ffa3c9a3000)
	libc.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libc.so.6 (0x00007ffa3c7bd000)
	/nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007ffa3d54f000)

Now it works, but just for me.

Originally posted by @goatchurchprime in #44 (comment)

MacOS, The developer cannot be verified

Godot version

v4.1.2.stable.official [399c9dc39]

Plugin version

v1.0.3

System information

macOS 13.6.0 - Vulkan (Forward+) - integrated Apple M1 - Apple M1 (8 Threads)

Issue description

System message in German language. The developer cannot be verified
Godot tries to load the lib several times, cancel not possible, MessageBox comes again and again. The application must be terminated in the Task Manager.

https://github.com/godotengine/webrtc-native/releases
godot-extension-4.1-webrtc.zip

image

Steps to reproduce

Minimal reproduction project

No response

webrtc with conan or docker

Hi, webrtc requires complex build process. Original webrtc requires boringssl, while most of open-source projects require openssl (can't use boringssl and openssl at same time, so need to patch and build webrtc from source)

I hope my draft (only for pre-built webrtc) will be helpful to integrate conan-webrtc or Dockerfile support
https://github.com/blockspacer/conan-webrtc/

Error: libatomic.so.1: cannot open shared object file: No such file or directory

Are the releases really static, or do they depend on libraries existing on the host? Is there anything we can do about this?

ERROR: open_dynamic_library: Can't open dynamic library: /home/matthew/git/goatchurchprime/godot_webrtc_mqtt/webrtc/lib/libwebrtc_native.linux.release.64.so. Error: libatomic.so.1: cannot open shared object file: No such file or directory
   At: drivers/unix/os_unix.cpp:415.

The macos library only supports x86 architectures

Godot version

3.4.4-stable

Plugin version

0.5

System information

MacOS, M2

Issue description

When loading the library on a M2 Mac:

E 0:00:00.186 open_dynamic_library: Can't open dynamic library: /Users/BimDav/Developer/AGoodDay/webrtc/lib/libwebrtc_native.osx.release.64.dylib, error: dlopen(/Users/BimDav/Developer/AGoodDay/webrtc/lib/libwebrtc_native.osx.release.64.dylib, 0x0002): tried: '/Users/BimDav/Developer/AGoodDay/webrtc/lib/libwebrtc_native.osx.release.64.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')).
<Erreur C++> Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN

platform/osx/os_osx.mm:1917 @ open_dynamic_library()

Steps to reproduce

Use the official release library on a mac with arm architecture

Minimal reproduction project

No response

Exporting to MacOS creates an error.

Godot version

4.0.stable

Plugin version

v1.0.0-rc1

System information

Windows 11

Issue description

When you export for MacOS the following error occurs:
No suitable library found for GDExtension: res://webrtc/webrtc.gdextension. Possible feature flags for your platform: pc, s3tc, macos, universal, bptc, template, debug, template_debug

The exported game will also not work if you're trying to use webrtc.

Steps to reproduce

  • create a project
  • add the extension to your project
  • export to macos

Minimal reproduction project

webrtc_minimal.zip
you have to add the plugin yourself because github doesnt allow files over 25MB

webrtc_native.windows.debug.64.dll error: Error 126

Godot Engine v3.3.2
OS:Windows 10 x64
Godot Webrtc plugin v5

When runs progect at editor displays this ERROR: Can't open dynamic library: C:/Users/Yura/Projects/Godot/Test/webrtc_debug/lib/webrtc_native.windows.debug.64.dll, error: Error 126: ะะต ะฝะฐะนะดะตะฝ ัƒะบะฐะทะฐะฝะฝั‹ะน ะผะพะดัƒะปัŒ.
.
at: open_dynamic_library (platform/windows/os_windows.cpp:2323) - Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN

Note: the file webrtc_native.windows.debug.64.dll is exists, and I think that the problem is inside dll or etc.

error:Cound not get branch revision

TLDR

./build.sh -c x64 -b branch-heads/68 no longer works properly in the repo and spits out the above error, when building on a mac.

Context

I've been trying to build webrtc for mac. Notwithstanding the fact that this has been done already in this issue: #8, I only noticed that after doing some investigation that led me down a particular path.

In #4, I encountered the same problem as shintiger. After managing to get things to build for the mac platform, I came across the error in this issue fatal error: api/peerconnectioninterface.h: No such file or directory, then searched the issues for this project and came across said thread.

Hypothesis

Some amateur sleuthing for the above error suggests that it looks like the old way of getting Chromium code has been obsoleted. This uses things that look familiar from this codebase, like ninga, gclient, out directories, etc.

Therefore it appears that scripts will need to be updated to get the Chromium code using this new approach.

I'm not sure how that impacts getting things like branch 68
https://chromium.googlesource.com/external/webrtc/+/branch-heads/68 via the invocation ./build.sh -c x64 -b branch-heads/68, but certainly the latter command no longer works with the change in the way Chromium code gets fetched.

rpc_id and rpc commands not reliable

When using the webrtc plugin, I created a script to check the network latency and perform error correction:

#TIMING COORDINATION

var sent_timings = []
var received_timings = []

func perform_latency_correction(id):
	for _i in range(9):

		sent_timings.append(curTime)
		rpc_id(id,"send_response_to_server")
		yield(get_tree().create_timer(0.05),"timeout")
	while len(received_timings) < 9:
		print('stuck')
		print(len(sent_timings))
		print(len(received_timings))
		yield(get_tree().create_timer(0.05),"timeout")
	var time_diffs = []
	for i in range(9):
		time_diffs.append(received_timings[i] - sent_timings[i])
	time_diffs.sort()
	var total_lag = time_diffs[4]
	print(received_timings)
	print(sent_timings)
	print("Total Lag:",total_lag)

remote func store_response_from_client():
	yield(fakeLag(),"timeout")
	received_timings.append(curTime)

remote func send_response_to_server():
	yield(fakeLag(),"timeout")
	rpc_id(1,"store_response_from_client")

#Function for simulating lag
func fakeLag():
	return get_tree().create_timer(FAKE_LAG_SECS)

#TIMING COORDINATION

However, this function fails intermittently, with some rpc_id calls not reaching the other user
image

Interestingly, we no longer experience the intermittent issue when adding a print statement before the rpc call

#TIMING COORDINATION

var sent_timings = []
var received_timings = []

func perform_latency_correction(id):
	for _i in range(9):
		print('WITH THIS PRINT IT WILL NO LONGER FAIL')
		sent_timings.append(curTime)
		rpc_id(id,"send_response_to_server")
		yield(get_tree().create_timer(0.05),"timeout")
	while len(received_timings) < 9:
		print('stuck')
		print(len(sent_timings))
		print(len(received_timings))
		yield(get_tree().create_timer(0.05),"timeout")
	var time_diffs = []
	for i in range(9):
		time_diffs.append(received_timings[i] - sent_timings[i])
	time_diffs.sort()
	var total_lag = time_diffs[4]
	print(received_timings)
	print(sent_timings)
	print("Total Lag:",total_lag)

remote func store_response_from_client():
	yield(fakeLag(),"timeout")
	received_timings.append(curTime)

remote func send_response_to_server():
	yield(fakeLag(),"timeout")
	rpc_id(1,"store_response_from_client")

#Function for simulating lag
func fakeLag():
	return get_tree().create_timer(FAKE_LAG_SECS)

#TIMING COORDINATION

The above code always returning this:
image

Other things that we have tried:
Running two rpc_id commands in a row with the print command (THIS WORKS):

func perform_latency_correction(id):
	for _i in range(9):
		print('WITH THIS PRINT IT WILL NO LONGER FAIL')
		sent_timings.append(curTime)
		rpc_id(id,"send_response_to_server")
		rpc_id(id,"send_response_to_server")
		yield(get_tree().create_timer(0.05),"timeout")

Running two rpc_id commands in a row without the print command (DOES NOT WORK):

func perform_latency_correction(id):
	for _i in range(9):
		
		sent_timings.append(curTime)
		rpc_id(id,"send_response_to_server")
		rpc_id(id,"send_response_to_server")
		yield(get_tree().create_timer(0.05),"timeout")

Note that the above command, when fails for both rpc calls

Sample webrtc debug print when above fails with this output:
image

Godot Engine v3.2.1.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce RTX 2070 with Max-Q Design/PCIe/SSE2

Join Button Pressed
Connected 1832737670
Peer connected 1
(opensslidentity.cc:45): Making key pair
(peerconnection.cc:849): Session: 2527941224590814886 is destroyed.
(opensslidentity.cc:93): Returning key pair
(opensslcertificate.cc:58): Making certificate for WebRTC
(opensslcertificate.cc:105): Returning certificate
(opensslidentity.cc:45): Making key pair
(peerconnection.cc:5072): AddSctpDataStream called when sctp_transport_ is NULL.
(peerconnection.cc:5072): AddSctpDataStream called when sctp_transport_ is NULL.
(peerconnection.cc:5072): AddSctpDataStream called when sctp_transport_ is NULL.
(opensslidentity.cc:93): Returning key pair
(opensslcertificate.cc:58): Making certificate for WebRTC
Setting Network Peer
WwwREf1QdjIYlK2M
(opensslcertificate.cc:105): Returning certificate
Network Players: {1832737670:{char:res://Players/Axeman.tscn, name:Philip Wee}}

Got offer: 1
(webrtcsdp.cc:2955): Ignored line: a=sctpmap:5000 webrtc-datachannel 1024
(webrtcsdp.cc:1727): AddSctpDataCodec: Got SCTP Port Number 5000
(p2ptransportchannel.cc:437): Set backup connection ping interval to 25000 milliseconds.
(p2ptransportchannel.cc:446): Set ICE receiving timeout to 2500 milliseconds
(p2ptransportchannel.cc:453): Set ping most likely connection to 0
(p2ptransportchannel.cc:460): Set stable_writable_connection_ping_interval to 2500
(p2ptransportchannel.cc:473): Set presume writable when fully relayed to 0
(p2ptransportchannel.cc:482): Set regather_on_failed_networks_interval to 300000
(p2ptransportchannel.cc:501): Set receiving_switching_delay to 1000
(dtlssrtptransport.cc:57): Setting RTCP Transport on data transport 0000000000000000
(dtlssrtptransport.cc:62): Setting RTP Transport on data transport 000000000EA983B0
(p2ptransportchannel.cc:385): Received remote ICE parameters: ufrag=gb33, renomination disabled
(peerconnection.cc:3506): Session: 7894624426572364422 Old state: kStable New state: kHaveRemoteOffer
(peerconnection.cc:4756): Local and Remote descriptions must be applied to get the SSL Role of the SCTP transport.
(peerconnection.cc:4778): Local and Remote descriptions must be applied to get the SSL Role of the session.
(peerconnection.cc:5393): data is not ready to use the remote candidate because the local or remote description is not set.
(peerconnection.cc:5393): data is not ready to use the remote candidate because the local or remote description is not set.
(peerconnection.cc:5393): data is not ready to use the remote candidate because the local or remote description is not set.
createdanswer
(webrtcsdp.cc:2955): Ignored line: a=sctpmap:5000 webrtc-datachannel 1024
(webrtcsdp.cc:1727): AddSctpDataCodec: Got SCTP Port Number 5000
(dtlssrtptransport.cc:57): Setting RTCP Transport on data transport 0000000000000000
(dtlssrtptransport.cc:62): Setting RTP Transport on data transport 000000000EA983B0
(p2ptransportchannel.cc:374): Set ICE ufrag: /HXf pwd: x7vYNbzdu+jkqXyraYP+/hjv on transport data
(dtlstransport.cc:383): DtlsTransport[data|1|__]: DTLS setup complete.
(peerconnection.cc:3506): Session: 7894624426572364422 Old state: kHaveRemoteOffer New state: kStable
(peerconnection.cc:3463): Changing IceConnectionState 0 => 1
(basicportallocator.cc:339): Start getting ports with prune_turn_ports disabled
(basicportallocator.cc:107): Filtered out ignored networks:
(basicportallocator.cc:109): Net[Software:::1/128:Loopback:id=4]
(basicportallocator.cc:109): Net[Software:127.0.0.1/32:Loopback:id=3]
(basicportallocator.cc:829): Network manager has started
(basicportallocator.cc:107): Filtered out ignored networks:
(basicportallocator.cc:109): Net[Software:::1/128:Loopback:id=4]
(basicportallocator.cc:109): Net[Software:127.0.0.1/32:Loopback:id=3]
(basicportallocator.cc:744): Allocate ports on 3 networks
(basicportallocator.cc:1284): Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]: Allocation Phase=Udp
(port.cc:328): Port[000000000EB45AF0::1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Port created with network cost 0
(basicportallocator.cc:1355): AllocationSequence: UDPPort will be handling the STUN candidate generation.
(basicportallocator.cc:851): Adding allocated port for data
(basicportallocator.cc:871): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Added port to allocator
(basicportallocator.cc:889): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Gathered candidate: Cand[:3490071206:1:udp:2122262783:[2620:9b::192d:fd47]:49514:local::0:/HXf:x7vYNbzdu+jkqXyraYP+/hjv:2:0:0]
(basicportallocator.cc:917): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Port ready.
(port.cc:1086): Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|C--W|-|0|0|9115049250747470334|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 1
(p2ptransportchannel.cc:1716): Channel[data|1|__]: Transport channel state changed from 0 to 2
(jseptransportcontroller.cc:1158): data Transport 1 state changed. Check if state is complete.
(p2ptransportchannel.cc:1288): Channel[data|1|__]: Have a pingable connection for the first time; starting to ping.
(stunport.cc:392): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Starting STUN host lookup for stun.l.google.com:19302
(basicportallocator.cc:1284): Net[Realtek:192.168.0.105/32:Ethernet:id=1]: Allocation Phase=Udp
(port.cc:328): Port[000000000EB8DF60::1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Port created with network cost 0
(basicportallocator.cc:1355): AllocationSequence: UDPPort will be handling the STUN candidate generation.
(basicportallocator.cc:851): Adding allocated port for data
(basicportallocator.cc:871): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Added port to allocator
(basicportallocator.cc:889): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Gathered candidate: Cand[:1221703924:1:udp:2122194687:192.168.0.105:49515:local::0:/HXf:x7vYNbzdu+jkqXyraYP+/hjv:1:0:0]
(basicportallocator.cc:917): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Port ready.
(port.cc:1086): Conn[000000000EB9B1E0:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--W|-|0|0|9114756780654345726|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 2
(port.cc:1086): Conn[000000000EB9BE70:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|C--W|-|0|0|9114475305677635070|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 3
(port.cc:1086): Conn[000000000EB9CB00:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->3lvkWPsm:1:1685987071:stun:udp:219.75.109.151:57718|C--W|-|0|0|7241259335668219390|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 4
(p2ptransportchannel.cc:1716): Channel[data|1|__]: Transport channel state changed from 2 to 1
(jseptransportcontroller.cc:1158): data Transport 1 state changed. Check if state is complete.
(stunport.cc:392): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Starting STUN host lookup for stun.l.google.com:19302
(basicportallocator.cc:1284): Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]: Allocation Phase=Udp
(port.cc:328): Port[000000000EB998F0::1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Port created with network cost 0
(basicportallocator.cc:1355): AllocationSequence: UDPPort will be handling the STUN candidate generation.
(basicportallocator.cc:851): Adding allocated port for data
(basicportallocator.cc:871): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Added port to allocator
(basicportallocator.cc:889): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Gathered candidate: Cand[:3192801181:1:udp:2122129151:172.27.29.15:49516:local::0:/HXf:x7vYNbzdu+jkqXyraYP+/hjv:5:0:0]
(basicportallocator.cc:917): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Port ready.
(port.cc:1086): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--W|-|0|0|9114475305677635071|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 5
(port.cc:1086): Conn[000000000EBA8A80:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|C--W|-|0|0|9114475305677503998|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 6
(port.cc:1086): Conn[000000000EBA9710:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->3lvkWPsm:1:1685987071:stun:udp:219.75.109.151:57718|C--W|-|0|0|7241259335668088318|-]: Connection created
(p2ptransportchannel.cc:1074): Channel[data|1|__]: Created connection with origin: 2, total: 7
(stunport.cc:392): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Starting STUN host lookup for stun.l.google.com:19302
(port.cc:1711): Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|C--W|-|0|0|9115049250747470334|-]: Sent STUN ping, id=54625555654b65315061514c, use_candidate=0, nomination=0
(stunport.cc:405): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: StunPort: stun host lookup received error 0
(basicportallocator.cc:991): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Port completed gathering candidates.
(thread.cc:273): Waiting for the thread to join, but blocking calls have been disallowed
(thread.cc:273): Waiting for the thread to join, but blocking calls have been disallowed
(thread.cc:273): Waiting for the thread to join, but blocking calls have been disallowed
(port.cc:1243): Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|C--I|-|0|0|9115049250747470334|-]: Received STUN ping, id=35666546336150526278432f
(port.cc:807): Port[000000000EB45AF0:data:1:0:local:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]]: Sent STUN ping response, to=[2620:9b::192d:fd47]:57717, id=35666546336150526278432f
(p2ptransportchannel.cc:933): Not switching the selected connection on controlled side yet: Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|CR-I|-|1|0|9115049250747470334|-]
(port.cc:1655): Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|CR-I|-|1|0|9115049250747470334|-]: Received STUN ping response, id=54625555654b65315061514c, code=0, rtt=7, pings_since_last_response=54625555654b65315061514c
(p2ptransportchannel.cc:253): Switching selected connection due to: candidate pair state changed
(p2ptransportchannel.cc:1674): Channel[data|1|__]: New selected connection: Conn[000000000EB5C890:data:Net[LogMeIn:2620:9b::192d:fd47/128:Ethernet:id=2]:yubgnfM1:1:0:local:udp:[2620:9b::192d:fd47]:49514->z034NaYK:1:2122262783:local:udp:[2620:9b::192d:fd47]:57717|CRWS|S|1|0|9115049250747470334|7]
(dtlstransport.cc:808): DtlsTransport[data|1|__]: configuring DTLS handshake timeout 50 based on ICE RTT 7
(opensslstreamadapter.cc:760): BeginSSL with peer.
(openssladapter.cc:819): SSL_connect:TLS client enter_early_data
(openssladapter.cc:819): SSL_connect:TLS client read_hello_verify_request
(openssladapter.cc:829): SSL_connect:error in TLS client read_hello_verify_request
(dtlstransport.cc:717): DtlsTransport[data|1|__]: DtlsTransport: Started DTLS handshake
(srtptransport.cc:354): The params in SRTP transport are reset.
(basicportallocator.cc:1087): All candidates gathered for data:1:0
(p2ptransportchannel.cc:766): P2PTransportChannel: data, component 1 gathering complete
(basicportallocator.cc:889): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Gathered candidate: Cand[:3382296128:1:udp:1685987071:219.75.109.151:49515:stun:192.168.0.105:49515:/HXf:x7vYNbzdu+jkqXyraYP+/hjv:1:0:0]
(basicportallocator.cc:894): Discarding candidate because port is already done gathering.
(basicportallocator.cc:991): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Port completed gathering candidates.
(openssladapter.cc:819): SSL_connect:TLS client read_server_hello
(openssladapter.cc:819): SSL_connect:TLS client read_server_certificate
(openssladapter.cc:819): SSL_connect:TLS client read_certificate_status
(openssladapter.cc:819): SSL_connect:TLS client verify_server_certificate
(opensslstreamadapter.cc:1084): Accepted peer certificate.
(openssladapter.cc:819): SSL_connect:TLS client read_server_key_exchange
(openssladapter.cc:819): SSL_connect:TLS client read_certificate_request
(openssladapter.cc:819): SSL_connect:TLS client read_server_hello_done
(openssladapter.cc:819): SSL_connect:TLS client send_client_certificate
(openssladapter.cc:819): SSL_connect:TLS client send_client_key_exchange
(openssladapter.cc:819): SSL_connect:TLS client send_client_certificate_verify
(openssladapter.cc:819): SSL_connect:TLS client send_client_finished
(openssladapter.cc:819): SSL_connect:TLS client finish_flight
(openssladapter.cc:819): SSL_connect:TLS client read_session_ticket
(openssladapter.cc:829): SSL_connect:error in TLS client read_session_ticket
(openssladapter.cc:819): SSL_connect:TLS client process_change_cipher_spec
(openssladapter.cc:819): SSL_connect:TLS client read_server_finished
(openssladapter.cc:819): SSL_connect:TLS client finish_client_handshake
(openssladapter.cc:819): SSL_connect:TLS client done
(dtlstransport.cc:645): DtlsTransport[data|1|__]: DTLS handshake complete.
(jseptransportcontroller.cc:1088):  Transport data writability changed to 1.
(dtlssrtptransport.cc:215): Extracting keys from transport: data
(peerconnection.cc:5223): Changing to ICE connected state because all transports are writable.
(peerconnection.cc:3463): Changing IceConnectionState 1 => 2
(srtptransport.cc:294): SRTP activated with negotiated parameters: send cipher_suite 1 recv cipher_suite 1
(sctptransport.cc:233): cricket::SctpTransport::UsrSctpWrapper::InitializeUsrSctp
Player connected
1 is connected. RPCing register player now
Network Players: {1:{char:res://Players/Axeman.tscn, name:Philip Wee}, 1832737670:{char:res://Players/Axeman.tscn, name:Philip Wee}}

(port.cc:1243): Conn[000000000EB9B1E0:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--W|-|0|0|9114756780654345726|-]: Received STUN ping, id=45396f433158367534554950
(port.cc:807): Port[000000000EB8DF60:data:1:0:local:Net[Realtek:192.168.0.105/32:Ethernet:id=1]]: Sent STUN ping response, to=192.168.0.105:57718, id=45396f433158367534554950
(p2ptransportchannel.cc:2284): Selecting connection for triggered check: Conn[000000000EB9B1E0:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|CR-W|-|0|0|9114756780654345726|-]
(port.cc:1711): Conn[000000000EB9B1E0:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|CR-W|-|0|0|9114756780654345726|-]: Sent STUN ping, id=614678514d745a7a59447244, use_candidate=0, nomination=0
(port.cc:1655): Conn[000000000EB9B1E0:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|CR-I|-|0|0|9114756780654345726|-]: Received STUN ping response, id=614678514d745a7a59447244, code=0, rtt=0, pings_since_last_response=614678514d745a7a59447244
(port.cc:1357): Conn[000000000EB9BE70:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|C--W|-|0|0|9114475305677635070|-]: Connection pruned
(port.cc:1357): Conn[000000000EB9CB00:data:Net[Realtek:192.168.0.105/32:Ethernet:id=1]:B4NH1TxE:1:0:local:udp:192.168.0.105:49515->3lvkWPsm:1:1685987071:stun:udp:219.75.109.151:57718|C--W|-|0|0|7241259335668219390|-]: Connection pruned
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--W|-|0|0|9114475305677635071|-]: Sent STUN ping, id=47574a57576d73734648427a, use_candidate=0, nomination=0
(port.cc:1243): Conn[000000000EBA8A80:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|C--W|-|0|0|9114475305677503998|-]: Received STUN ping, id=38314544426b6b6c49525162
(port.cc:807): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Sent STUN ping response, to=172.27.29.15:57719, id=38314544426b6b6c49525162
(p2ptransportchannel.cc:2284): Selecting connection for triggered check: Conn[000000000EBA8A80:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|CR-W|-|0|0|9114475305677503998|-]
(port.cc:1711): Conn[000000000EBA8A80:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|CR-W|-|0|0|9114475305677503998|-]: Sent STUN ping, id=544e4a6a352f5978556b684b, use_candidate=0, nomination=0
(port.cc:1655): Conn[000000000EBA8A80:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->QdUELJ5+:1:2122129151:local:udp:172.27.29.15:57719|CR-I|-|0|0|9114475305677503998|-]: Received STUN ping response, id=544e4a6a352f5978556b684b, code=0, rtt=1, pings_since_last_response=544e4a6a352f5978556b684b
(port.cc:1357): Conn[000000000EBA9710:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->3lvkWPsm:1:1685987071:stun:udp:219.75.109.151:57718|C--W|-|0|0|7241259335668088318|-]: Connection pruned
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=56394839584f2b5568684a37, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=58654b4d45316e4135745a57, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=6d6659316a4e457838335a5a, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=7434474c41725a7270483055, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=7a515049675152637747746e, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=427a39714351524d366b4c6d, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=7a6f4868306c727142624951, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=6850627256504f434533724b, use_candidate=0, nomination=0
(port.cc:1758): Connection deleted with number of pings sent: 0
(p2ptransportchannel.cc:2122): Channel[data|1|RW]: Removed connection 000000000EB9BE70 (6 remaining)
(port.cc:1758): Connection deleted with number of pings sent: 0
(p2ptransportchannel.cc:2122): Channel[data|1|RW]: Removed connection 000000000EB9CB00 (5 remaining)
(port.cc:1758): Connection deleted with number of pings sent: 0
(p2ptransportchannel.cc:2122): Channel[data|1|RW]: Removed connection 000000000EBA9710 (4 remaining)
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=567175774871306664563868, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=4d38557266765171476f314b, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=337a777039337351654b5845, use_candidate=0, nomination=0
(port.cc:1711): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Sent STUN ping, id=6331436a5168364c44436451, use_candidate=0, nomination=0
(port.cc:1448): Conn[000000000EBA7DF0:data:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]:oP+vZj9S:1:0:local:udp:172.27.29.15:49516->U3KkwIDF:1:2122194687:local:udp:192.168.0.105:57718|C--I|-|0|0|9114475305677635071|-]: Timed out after 15015 ms without a response, rtt=6000
(p2ptransportchannel.cc:1716): Channel[data|1|RW]: Transport channel state changed from 1 to 2
(jseptransportcontroller.cc:1158): data Transport 1 state changed. Check if state is complete.
(port.cc:1758): Connection deleted with number of pings sent: 13
(p2ptransportchannel.cc:2122): Channel[data|1|RW]: Removed connection 000000000EBA7DF0 (3 remaining)
(stunport.cc:87): Binding request timed out from 172.27.29.15:49516 (ZeroTier One [a0cbf4b62aaa1de6])
(basicportallocator.cc:991): Port[000000000EB998F0:data:1:0:local:Net[ZeroTier:172.27.29.15/32:Ethernet:id=5]]: Port completed gathering candidates.

Godot version: v3.2.1
WebRTC version: v0.3 (Both debug and release versions have the issue)

Relevant files:
Network.zip
We used the multiplayer_client.gd ws_webrtc_client.gd from the bomber demo but perhaps with some slight changes so that could be causing the issue too

If you would like the whole game file please drop me a message I'll send the entire file over

Release export crash

Godot version

v4.0.2.stable

Plugin version

v1.0.0-rc1

System information

Arch linux: 6.3.2-arch1-1

Issue description

When exporting a game as release not debug it will crash when a connection is attempted:
image

Steps to reproduce

Minimal reproduction project

https://github.com/godotengine/godot-demo-projects/tree/master/networking/webrtc_minimal

Cannot build on Windows

Godot version

4(master)

Plugin version

master(1436024)

System information

Windows 11 Pro 22H2 64 bit

Issue description

I get following error when trying to build on Windows with llvm-mingw:

> scons -j1
scons: Reading SConscript files ...
Building for architecture x86_64 on platform windows
scons: done reading SConscript files.
scons: Building targets ...
scons: `godot-cpp\bin\libgodot-cpp.windows.template_debug.x86_64.a' is up to date.
ssl_action(["deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libssl.a", "deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libcrypto.a"], ["deps\openssl"])
mkdir -p D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/openssl
The syntax of the command is incorrect.
scons: *** Error 1
rtc_action(["deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\libdatachannel-static.a", "deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libjuice\libjuice-static.a", "deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libsrtp\libsrtp2.a", "deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\usrsctp\usrsctplib\libusrsctp.a"], ["deps\libdatachannel", "deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libssl.a", "deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libcrypto.a"])
cmake -B D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/libdatachannel -DUSE_NICE=0 -DNO_WEBSOCKET=1 -DNO_EXAMPLES=1 -DNO_WEBSOCKET=1 -DNO_TESTS=1 -DOPENSSL_USE_STATIC_LIBS=1 -DOPENSSL_INCLUDE_DIR=D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/openssl/dest/include -DOPENSSL_SSL_LIBRARY=D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/openssl/libssl.a -DOPENSSL_CRYPTO_LIBRARY=D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/openssl/libcrypto.a -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=D:\Repo\webrtc-native\deps/build/build.windows.template_debug.x86_64.Release.dir/openssl -G 'Unix Makefiles' -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_SYSTEM_NAME=Windows D:\Repo\webrtc-native\deps\libdatachannel
'cmake' is not recognized as an internal or external command,
operable program or batch file.
scons: *** Error 1
g++  -shared -o bin\extension\webrtc\lib\webrtc_native.windows.template_debug.x86_64.dll src\WebRTCLibDataChannel.o src\WebRTCLibPeerConnection.o src\init_gdextension.o $( -Ldeps\build\build.windows.template_debug.x86_64.Release.dir\openssl -Lgodot-cpp\bin -Ldeps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel $) deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\libdatachannel-static.a deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libjuice\libjuice-static.a deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libsrtp\libsrtp2.a deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\usrsctp\usrsctplib\libusrsctp.a -lgodot-cpp.windows.template_debug.x86_64 deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libssl.a deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libcrypto.a -liphlpapi -lws2_32 -lbcrypt -Wl,--out-implib,libwebrtc_native.windows.template_debug.x86_64.a
=====
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\libdatachannel-static.a'
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libjuice\libjuice-static.a'
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\libsrtp\libsrtp2.a'
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\libdatachannel\deps\usrsctp\usrsctplib\libusrsctp.a'
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libssl.a'
clang-14: error: no such file or directory: 'deps\build\build.windows.template_debug.x86_64.Release.dir\openssl\libcrypto.a'

=====
scons: *** [bin\extension\webrtc\lib\webrtc_native.windows.template_debug.x86_64.dll] Error 1
scons: building terminated because of errors.

I have cmake installed and in path.

Steps to reproduce

  1. Run scons.

Minimal reproduction project

No response

libwebrtc_native.osx.release.64.dylib Error: Symbol not found: ____chkstk_darwin

Godot version

3.3.4.stable.official

Plugin version

0.5

System information

macOS 10.13.6

Issue description

I downloaded the official Godot WebRTC Signalling Demo and added the latest release version (0.5) of the webrtc-native plugin in the root location of the godot project. I then pressed play in the editor window and the demo window appeared. Then, when I click on the "Listen" button at the top of the window, I get the next error in the godot debugger:

E 0:00:00.417 open_dynamic_library: Can't open dynamic library: /Users/K/Documents/_PROJECTS/P2P_Test/_GodotTest/webrtc/lib/libwebrtc_native.osx.release.64.dylib, error: dlopen(/Users/K/Documents/_PROJECTS/P2P_Test/_GodotTest/webrtc/lib/libwebrtc_native.osx.release.64.dylib, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Users/K/Documents/_PROJECTS/P2P_Test/_GodotTest/webrtc/lib/libwebrtc_native.osx.release.64.dylib (which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/K/Documents/_PROJECTS/P2P_Test/_GodotTest/webrtc/lib/libwebrtc_native.osx.release.64.dylib.
<C++ Error> Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
<C++ Source> platform/osx/os_osx.mm:1944 @ open_dynamic_library()

Steps to reproduce

  1. Download the WebRTC Signalling demo
    https://godotengine.org/asset-library/asset/537
  2. Download webrtc-native release plugin ver. 0.5, unpack, and add the folder into the root of the WebRTC Signalling demo project.
    https://github.com/godotengine/webrtc-native/releases/tag/0.5
  3. Open the project in Godot 3.3.4.stable.official on macOS 10.13.6 and press Play.
  4. In the demo window press "Listen" button at the top and check the error in the Godot debugger.

Minimal reproduction project

No response

deriving from WebRTCPeerConnection (in c#) results in runtime error during construction.

Godot version 3.2.2
Error as follows:

E 0:00:00.625 set_script_and_instance: Condition "script_instance != __null || !script.is_null()" is true.
<C++ Source> core/object.cpp:1008 @ set_script_and_instance()
:0 @ IntPtr Godot.NativeCalls.godot_icall_WebRTCPeerConnection_Ctor(Godot.WebRTCPeerConnection )()
WebRTCPeerConnection.cs:52 @ Godot.WebRTCPeerConnection..ctor()()
Spatial.cs:9 @ Spatial+WebRTCBar..ctor()()
Spatial.cs:17 @ void Spatial._Ready()()

Minimal reproduction project below:
WebRTCPeerConnectionIssue.zip

webrtc v1.0.0-alpha2 zeroing all subsequent binary data of the packet after one null byte send

Godot version

v3.4.4.stable.official [419e713a2]

Plugin version

v1.0.0-alpha2

System information

Windows 10

Issue description

Zeroing all subsequent binary data of the packet after one null byte sending.
Datachannel connection successfull, but when you try to send binary data via datachannel for example put_packet(PoolByteArray([1,2,0,4,5,6,7,8,9]) at another side you recieved [1,2,0,0,0,0,0,0,0]

Steps to reproduce

try to send put_packet(PoolByteArray([1,2,0,4,5,6,7,8,9]) via data channel and recieve result at other side.

Minimal reproduction project

WebRTC Minimal Demo.zip
need to add webrtc native v1.0.0-alpha2 to this demo godot progect, i removed them becaurse file size too big for upload.

Linux: bad glibc version

Godot version

4.0.2-stable

Plugin version

v1.0.0-rc1

System information

Docker Ubuntu 16.04

Issue description

I have a docker container with my custom godot build running on Ubuntu 16.04, I use the container for CI exports of my game. It seems like the addon is being built on a system with too new of a glib C version:

ERROR: Can't open dynamic library: /build/addons/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so. Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /build/addons/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so)
   at: open_dynamic_library (drivers/unix/os_unix.cpp:447)
ERROR: GDExtension dynamic library not found: /build/addons/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so
   at: open_library (core/extension/gdextension.cpp:400)
ERROR: Failed loading resource: res://addons/webrtc/webrtc.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:222)

Maybe build root could be used here? If not maybe the releases should be built by hand on a VM.

Steps to reproduce

Try to use the extension on Ubuntu 16.04

Minimal reproduction project

N/A

MediaStream support?

I was wondering what the current state/progress is with MediaStream support? I'd like to help implement this if possible, primarily for voice chat, and would appreciate some pointers.

NetSocket connect_to_host fails on windows when plugin is enabled

From @dryw cfr: #5 (comment)

webrtc-native plugin disabled:

Windows client connects to signalling server and receives a lobby ID.
Throws an ERR_UNCONFIGURED error when an RPC is made (to be expected)
Even just building and then deleting the copied-over webRTC dll will get you to this state.

webrtc-native plugin enabled:

Socket error 10022 (drivers/unix/net_socket_posix.cpp:197 @ _get_socket_error())
Signalling server does not even see the request

And @tomoprime #5 (comment)

I (@Faless) can too confirm this issue.

I suspect the "beautiful" windows socket subsytem to be the cause. I'm investigating...

Is is possible to make a build for every Godot 4.0 beta?

Godot version

4.0 beta2

Plugin version

latest

System information

windows 10

Issue description

Hi there.

I cannot build it for beta2 on my own. Maybe it's possible to make a build for every beta?
Or maybe make a better explanation on build process.

If you are interested, I got this errors:
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/libdatachannel/libdatachannel-static.a: No such file or directory
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/libdatachannel/deps/libjuice/libjuice-static.a: No such file or directory
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/libdatachannel/deps/libsrtp/libsrtp2.a: No such file or directory
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/libdatachannel/deps/usrsctp/usrsctplib/libusrsctp.a: No such file or directory
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/openssl/libssl.a: No such file or directory
x86_64-w64-mingw32-g++: error: deps/build/windows.debug.x86_64.dir/openssl/libcrypto.a: No such file or directory
scons: *** [bin/extension/webrtc_debug/lib/libwebrtc_native.windows.debug.x86_64.dll] Error 1
scons: building terminated because of errors.

Steps to reproduce

Trying to build for beta2, only updated godot-cpp to correct commit

Minimal reproduction project

No response

fatal error: api/peerconnectioninterface.h: No such file or directory

I've been trying to compile this with the latest Godot sources, and I've been getting this error:

In file included from src/WebRTCLibDataChannel.cpp:1:0:
src/WebRTCLibDataChannel.hpp:6:10: fatal error: api/peerconnectioninterface.h: No such file or directory
 #include "api/peerconnectioninterface.h" // interface for all things needed from WebRTC
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I can't seem to find the peerconnectioninterface.h file in the Godot source, or godot-cpp or godot_headers. What am I missing?

WebRTC library stuck on running hooks.

I'm trying to compile the WebRTC library with the script mentioned in the README on Linux (x64) with the command ./build.sh -b branch-heads/68, and part-way through the script it gets stuck at this line (for at least an hour):

Running hooks:  90% (27/30) msan_chained_origins

And after using Ctrl+C:

Failed while running "vpython src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-instrumented-libraries -s src/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1"
Interrupted
Hook 'vpython src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-instrumented-libraries -s src/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1' took 949.56 secs

I've also tried compiling the latest version of the library (which works), but the GDNative library doesn't work with it.

Is there a workaround for this? Should I build a different version of WebRTC?

SCons Build Error (Python3)?

I am getting this error on plugin build (using Android Pull request but also same error on normal plugin):

[cenk@archlinux webrtc-native]$ scons -j8 platform=android android_arch=arm64v8 target=debug
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `bin/webrtc_debug/lib/libwebrtc_native.android.debug.arm64v8.so' is up to date.
gen_gdnative_lib(["bin/webrtc_debug/webrtc_debug.gdns"], ["misc/gdnlib.tres"])
scons: *** [bin/webrtc_debug/webrtc_debug.gdns] TypeError : a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/SCons/Action.py", line 1209, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "/home/cenk/webrtc-native/SConstruct", line 15, in gen_gdnative_lib
    w.write(source[0].get_contents().replace('{GDNATIVE_PATH}', os.path.splitext(t.name)[0]).replace('{TARGET}', env['target']))
TypeError: a bytes-like object is required, not 'str'
scons: building terminated because of errors.
[cenk@archlinux webrtc-native]$

Might it has to do that i have to compile with python2? Unfortunately i can't get my system to use scons with python2 xd
Thanks!

Extension crashes on startup

Godot version

4.1.1

Plugin version

1.0.2

System information

Ubuntu 22.04

Issue description

After adding the extension to my project, attempting to start the project, or closing and re-opening the editor, results in a crash with the following report:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.1.stable.mono.official (bd6af8e0ea69167dd0627f3bd54f9105bda0f8b5)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f3acc880520] (??:0)
[2] std::__codecvt_utf8_utf16_base<char16_t>::do_unshift(__mbstate_t&, char*, char*, char*&) const (??:0)
[3] std::ostream& std::ostream::_M_insert<long>(long) (??:0)
[4] /usr/lib/dotnet/host/fxr/7.0.11/libhostfxr.so(+0x3a684) [0x7f3a982c9684] (??:0)
[5] /usr/lib/dotnet/host/fxr/7.0.11/libhostfxr.so(+0x26937) [0x7f3a982b5937] (??:0)
[6] /usr/lib/dotnet/host/fxr/7.0.11/libhostfxr.so(+0x28111) [0x7f3a982b7111] (??:0)
[7] /usr/lib/dotnet/host/fxr/7.0.11/libhostfxr.so(+0x221ab) [0x7f3a982b11ab] (??:0)
[8] /usr/lib/dotnet/host/fxr/7.0.11/libhostfxr.so(hostfxr_initialize_for_runtime_config+0xcf) [0x7f3a982accdf] (??:0)
[9] /home/erik/devel/godot/Godot_v4.1.1-stable_mono_linux_x86_64/Godot_v4.1.1-stable_mono_linux.x86_64() [0x15f75d1] (??:0)
[10] /home/erik/devel/godot/Godot_v4.1.1-stable_mono_linux_x86_64/Godot_v4.1.1-stable_mono_linux.x86_64() [0x1648396] (??:0)
[11] /home/erik/devel/godot/Godot_v4.1.1-stable_mono_linux_x86_64/Godot_v4.1.1-stable_mono_linux.x86_64() [0xf5b261] (??:0)
[12] /home/erik/devel/godot/Godot_v4.1.1-stable_mono_linux_x86_64/Godot_v4.1.1-stable_mono_linux.x86_64() [0xe598ed] (??:0)
[13] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f3acc867d90] (??:0)
[14] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f3acc867e40] (??:0)
[15] /home/erik/devel/godot/Godot_v4.1.1-stable_mono_linux_x86_64/Godot_v4.1.1-stable_mono_linux.x86_64() [0xe86e5e] (??:0)
-- END OF BACKTRACE --
================================================================

I tried doing the exact same thing on my Windows machine and I can run the project with no problems. I also tried building the extension from source and I got the exact same issue. I'm new to a lot of this, including Godot and WebRTC so I'm not sure where the issue lies.

Steps to reproduce

Unzip the extension .zip and place the webrtc folder in the root folder of the project, and attempt to run the project.

Minimal reproduction project

No response

When runing function create_offer() of WebRTCPeerConnection from the editor 1-10000 times, there is approximately 1 and more constant error _create_offer: Failed to gather local ICE candidates

Godot version

v3.5.3.stable.official [6c814135b]

Plugin version

all v1.0.0 - v1.0.5 (with libdatachannel)

System information

Windows 10, 64bit

Issue description

When runing function create_offer() of WebRTCPeerConnection from the editor 1-10000 times, there is approximately 1 and more variable randomness constant error _create_offer: Failed to gather local ICE candidates And as soon as an error occurs, all subsequent repetitions of the code also cause an error.
I also want to note that this error appears only in versions v1.0.0 - v1.0.5 with libdatachannel and is not present in version 0.5 - WebRTC 4472.

Steps to reproduce

To catch this error, you need run the application from the Godot editor with this code:

func _ready():
	var errMax:int = 10
	for _i in 10000:
		var wc1:WebRTCPeerConnection = WebRTCPeerConnection.new()
		var err1
		err1 = wc1.initialize()
		if err1 == OK:
			var channel:WebRTCDataChannel = wc1.create_data_channel("play",{"id": 1, "negotiated": true})
			if channel != null:
				err1 = wc1.create_offer()
				if err1 != OK:
					print_debug("Periodic Error!!!:_i:",_i)
					errMax -= 1
					if errMax <= 0:
						break
		wc1 = null

Minimal reproduction project

No response

[Android] Plugin not working with Godot 3.3.2 Android's custom builds (library not exported).

Hi, I was trying to figure out why my implementation of the plugin didn't work at all, which shouldn't happen since I'm recovering some code of another webRTC project (in that case, focused on Web environment).

The thing is, I realized it actually works connecting Windows to Windows builds, which can send packets among them, so the problem is setting the network peers on Android targets, which doesn't throw any error but leave the network peers' array empty.

So my question is, do I need to set some permission on the export settings to get it working properly?

Thank you in advance.

WebRTCPeerConnection crashes when initialized with TURN Server

The following code initializes correctly (The server is both STUN/TURN):
peer.initialize({ "iceServers": [ { "urls": ["stun:159.203.29.246:3478"] } ] })

However, the following will produce a backtrace:
peer.initialize({ "iceServers": [ { "urls": ["turn:159.203.29.246:3478"], "username": "dryw", "credentials": "testing123" } ] })

The crash appears to happen both on windows and linux. Editor is a custom build with Faless/godot@abcb079 + godot master godotengine/godot@930d6d8:

`Running: C:\Users\dpaulic\Desktop\godot\godot\bin\godot_windows_3.2_alpha2_Dryw.exe --path C:/Users/dpaulic/Desktop/bomber-rtc --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 6612 --position 448,240
Godot Engine v3.2.alpha.custom_build.acf1523e0 - https://godotengine.org
OpenGL ES 3.0 Renderer: Intel(R) HD Graphics 630

Connected 1456400343
Peer connected 1
ERROR: PeerConnection could not be created
ERROR: peer_connection.get() == nullptr
ERROR: WebRTCMultiplayer::add_peer: Condition ' p_peer->get_connection_state() != WebRTCPeerConnection::STATE_NEW ' is true. returned: ERR_INVALID_PARAMETER
At: modules\webrtc\webrtc_multiplayer.cpp:242
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] godot_nativescript_init
[1] godot_nativescript_init
[2] <couldn't map PC to fn name>
[3] NativeScriptInstance::scalar deleting destructor' [4] Object::~Object (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:1942) [5] WebRTCPeerConnectionGDNative::scalar deleting destructor'
[6] Ref::unref (c:\users\dpaulic\desktop\godot\godot\core\reference.h:279)
[7] Variant::clear (c:\users\dpaulic\desktop\godot\godot\core\variant.cpp:1165)
[8] Variant::call_ptr (c:\users\dpaulic\desktop\godot\godot\core\variant_call.cpp:1117)
[9] GDScriptFunction::call (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript_function.cpp:1082)
[10] GDScriptInstance::call (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript.cpp:1170)
[11] Object::call (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:900)
[12] Object::emit_signal (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:1218)
[13] Object::_emit_signal (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:1150)
[14] MethodBindVarArg::call (c:\users\dpaulic\desktop\godot\godot\core\method_bind.h:344)
[15] Object::call (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:921)
[16] Variant::call_ptr (c:\users\dpaulic\desktop\godot\godot\core\variant_call.cpp:1096)
[17] GDScriptFunction::call (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript_function.cpp:1082)
[18] GDScriptInstance::call (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript.cpp:1170)
[19] Object::call (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:900)
[20] Object::emit_signal (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:1218)
[21] Object::emit_signal (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:1275)
[22] WebSocketClient::_on_peer_packet (c:\users\dpaulic\desktop\godot\godot\modules\websocket\websocket_client.cpp:109)
[23] wslay_event_recv (c:\users\dpaulic\desktop\godot\godot\thirdparty\wslay\wslay_event.c:753)
[24] WSLPeer::poll (c:\users\dpaulic\desktop\godot\godot\modules\websocket\wsl_peer.cpp:231)
[25] WSLClient::poll (c:\users\dpaulic\desktop\godot\godot\modules\websocket\wsl_client.cpp:224)
[26] MethodBind0::call (c:\users\dpaulic\desktop\godot\godot\core\method_bind.gen.inc:150)
[27] Object::call (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:921)
[28] Variant::call_ptr (c:\users\dpaulic\desktop\godot\godot\core\variant_call.cpp:1096)
[29] GDScriptFunction::call (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript_function.cpp:1082)
[30] GDScriptInstance::call_multilevel (c:\users\dpaulic\desktop\godot\godot\modules\gdscript\gdscript.cpp:1180)
[31] Node::_notification (c:\users\dpaulic\desktop\godot\godot\scene\main\node.cpp:60)
[32] Object::notification (c:\users\dpaulic\desktop\godot\godot\core\object.cpp:933)
[33] SceneTree::_notify_group_pause (c:\users\dpaulic\desktop\godot\godot\scene\main\scene_tree.cpp:969)
[34] SceneTree::idle (c:\users\dpaulic\desktop\godot\godot\scene\main\scene_tree.cpp:526)
[35] Main::iteration (c:\users\dpaulic\desktop\godot\godot\main\main.cpp:1976)
[36] OS_Windows::run (c:\users\dpaulic\desktop\godot\godot\platform\windows\os_windows.cpp:3015)
[37] widechar_main (c:\users\dpaulic\desktop\godot\godot\platform\windows\godot_windows.cpp:162)
[38] _main (c:\users\dpaulic\desktop\godot\godot\platform\windows\godot_windows.cpp:186)
[39] main (c:\users\dpaulic\desktop\godot\godot\platform\windows\godot_windows.cpp:196)
[40] __scrt_common_main_seh (d:\agent_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[41] BaseThreadInitThunk
-- END OF BACKTRACE --
ERROR: NetSocketPosix::_get_socket_error: Socket error: 10054
At: drivers\unix\net_socket_posix.cpp:202`

This was tested using the bomber-rtc demo project. Removing "iceServers" and exposing the inner dictionary causes the program to run but it appears TURN servers do not function.

If a TURN server is required for testing, I can arrange credentials for mine!

Exporting .ipa to appstore fails

Godot version

4.1.0

Plugin version

webrtc-native-1.0.2-stable.zip

System information

Macbook Air M1

Issue description

Building for iOS Apple Distribution does not work, it throws two errors on a fresh Godot 4.1.0 project. I want it to work when i deploy my app to the store without any issues after adding the webrtc library.

Asset validation failed (90208)
Invalid Bundle. The bundle my_app.app/Frameworks/libwebrtc_native.ios.template_release.arm64.framework does not support the minimum OS Version specified in the Info.plist.

Asset validation failed (90049)
This bundle is invalid. The bundle at path Payload/my_app.app/Frameworks/libwebrtc_native.ios.template_release.arm64.framework has an invalid CFBundleIdentifier 'com.gdextension.framework.libwebrtc_native.ios.template_release.arm64' There are invalid characters(characters that are not dots, hyphen and alphanumerics) that have been replaced with their code point 'com.gdextension.framework.libwebrtc\u005fnative.ios.template\u005frelease.arm64' CFBundleIdentifier must be present, must contain only alphanumerics, dots, hyphens and must not end with a dot. [see the Core Foundation Keys at https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102070-TPXREF105] (ID: a1dc8e2d-631e-4a2a-8ffd-1c64d74c226f)

Steps to reproduce

Simply create a new project, import the webrtc library, build for iOS (Apple Distribution) and deploy to appstore trough XCode or otherwise.

The 'bundle is invalid. There are invalid characters' issue can be resolved by renaming com.gdnative.framework.libwebrtc_native.ios.release.arm64 to com.gdnative.webrtc-lib.

I could not figure out how to fix the minimum OS Version specified in the Info.plist yet. I tried to set the minimum OS Version to 10.0, 11.0, 12.0, 13.0 but none seem to work. I added the version to the plist and made a clean build before building each time.

Minimal reproduction project

No response

Plugin is available in the AssetLib but installs wrongly.

Godot version

v4.1.1.stable.mono.official [bd6af8e0e]

Plugin version

Version 1.02

System information

Windows 10, WebRTC Plugin - Godot 4.1+

Issue description

When downloading the plugin from the AssetLib on Godot 4.1 Mono, the plugin installs and fails to load, presenting errors. The errors imply that the plugin expects to be stored in a webrtc folder, however the contents of what would be in said folder are simply dumped into the root of the project folder.

This can be fixed easily by moving the plugin's files into a new webrtc folder, but do not have this default feels like a bug, as the plugin itself expects to be installed there out-of-the-box.

Steps to reproduce

In a new Godot 4.1.1 project, open the AssetLib, search for this plugin let the editor download and install the plugin. (Specifically the version for Godot 4.1+.)

The editor download's and installs, but dumps the entire contents of the repository directly into project folder instead of into a webrtc folder like the plugin is expecting. The editor reports immediate errors went trying to enable the extension.

It is fixed by creating a webrtc folder. dragging the contents of the plugin into it, and restarting the editor.

Minimal reproduction project

Not necessary, simply create an empty project and attempt to install the plugin through the AssetLib as described above.

Calling WebRTCPeerConnection.CreateDataChannel in C# throws External component has thrown an exception.

Godot version

4.0.beta.5

Plugin version

for beta5

System information

Windows 10 64bits

Issue description

Calling WebRTCPeerConnection.CreateDataChannel in C# throws External component has thrown an exception.

Steps to reproduce

Simply writing this in _Ready will cause a crash:

var peerConnection = new WebRTCPeerConnection();
var peerDataChannel = peerConnection.CreateDataChannel("chat", new Godot.Collections.Dictionary {
    {"id", 1},
    {"negotiated", true},
});

Minimal reproduction project

WebRTCBug.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.