mirror of
https://github.com/godotengine/webrtc-native.git
synced 2026-01-02 09:48:12 +03:00
Compare commits
15 Commits
1.0.0-beta
...
1.0.0-stab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e34000653b | ||
|
|
826a736176 | ||
|
|
b7098e7496 | ||
|
|
6de604ffee | ||
|
|
f0af5f9982 | ||
|
|
fbe4e06b9f | ||
|
|
9a9fc0953b | ||
|
|
c6b6f7e18c | ||
|
|
00f952bcf1 | ||
|
|
d7032f7b85 | ||
|
|
c9a1efc7a0 | ||
|
|
5bc4b79435 | ||
|
|
b7b76dddab | ||
|
|
0b1c55ed83 | ||
|
|
093ac7d489 |
12
.github/workflows/build_release.yml
vendored
12
.github/workflows/build_release.yml
vendored
@@ -84,17 +84,11 @@ jobs:
|
||||
|
||||
# macOS
|
||||
- platform: macos
|
||||
arch: 'x86_64'
|
||||
gdnative_flags: 'macos_arch=x86_64 bits=64'
|
||||
arch: 'universal'
|
||||
gdnative_flags: 'macos_arch=universal bits=64'
|
||||
sconsflags: ''
|
||||
os: 'macos-11'
|
||||
cache-name: macos-x86_64
|
||||
- platform: macos
|
||||
gdnative_flags: 'macos_arch=arm64 bits=64'
|
||||
arch: 'arm64'
|
||||
sconsflags: ''
|
||||
os: 'macos-11'
|
||||
cache-name: macos-arm64
|
||||
cache-name: macos-universal
|
||||
|
||||
# Windows
|
||||
- platform: windows
|
||||
|
||||
64
SConstruct
64
SConstruct
@@ -1,6 +1,7 @@
|
||||
#!python
|
||||
|
||||
import os, sys, platform, json, subprocess
|
||||
import SCons
|
||||
|
||||
|
||||
def add_sources(sources, dirpath, extension):
|
||||
@@ -68,6 +69,14 @@ if env["godot_version"] == "3":
|
||||
target_compat = "template_" + env["target"]
|
||||
env["suffix"] = ".{}.{}.{}".format(env["platform"], target_compat, env["arch_suffix"])
|
||||
env["debug_symbols"] = False
|
||||
|
||||
# Set missing CC for MinGW from upstream build module.
|
||||
if env["platform"] == "windows" and sys.platform != "win32" and sys.platform != "msys":
|
||||
# Cross-compilation using MinGW
|
||||
if env["bits"] == "64":
|
||||
env["CC"] = "x86_64-w64-mingw32-gcc"
|
||||
elif env["bits"] == "32":
|
||||
env["CC"] = "i686-w64-mingw32-gcc"
|
||||
else:
|
||||
ARGUMENTS["ios_min_version"] = "11.0"
|
||||
env = SConscript("godot-cpp/SConstruct").Clone()
|
||||
@@ -93,14 +102,6 @@ if env["godot_version"] == "3":
|
||||
else:
|
||||
result_path = os.path.join("bin", "extension", "webrtc")
|
||||
|
||||
# Dependencies
|
||||
for tool in ["cmake", "common", "ssl", "rtc"]:
|
||||
env.Tool(tool, toolpath=["tools"])
|
||||
|
||||
ssl = env.BuildOpenSSL()
|
||||
env.NoCache(ssl) # Needs refactoring to properly cache generated headers.
|
||||
rtc = env.BuildLibDataChannel()
|
||||
|
||||
# Our includes and sources
|
||||
env.Append(CPPPATH=["src/"])
|
||||
env.Append(CPPDEFINES=["RTC_STATIC"])
|
||||
@@ -118,12 +119,48 @@ else:
|
||||
sources.append("src/init_gdnative.cpp")
|
||||
add_sources(sources, "src/net/", "cpp")
|
||||
|
||||
env.Depends(sources, [ssl, rtc])
|
||||
# Since the OpenSSL build system does not support macOS universal binaries, we first need to build the two libraries
|
||||
# separately, then we join them together using lipo.
|
||||
mac_universal = env["platform"] == "macos" and env["arch"] == "universal"
|
||||
build_targets = []
|
||||
build_envs = [env]
|
||||
|
||||
# Make the shared library
|
||||
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
|
||||
library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
|
||||
Default(library)
|
||||
# For macOS universal builds, setup one build environment per architecture.
|
||||
if mac_universal:
|
||||
build_envs = []
|
||||
for arch in ["x86_64", "arm64"]:
|
||||
benv = env.Clone()
|
||||
benv["arch"] = arch
|
||||
benv["CCFLAGS"] = SCons.Util.CLVar(str(benv["CCFLAGS"]).replace("-arch x86_64 -arch arm64", "-arch " + arch))
|
||||
benv["LINKFLAGS"] = SCons.Util.CLVar(str(benv["LINKFLAGS"]).replace("-arch x86_64 -arch arm64", "-arch " + arch))
|
||||
benv["suffix"] = benv["suffix"].replace("universal", arch)
|
||||
benv["SHOBJSUFFIX"] = benv["suffix"] + benv["SHOBJSUFFIX"]
|
||||
build_envs.append(benv)
|
||||
|
||||
# Build our library and its dependencies.
|
||||
for benv in build_envs:
|
||||
# Dependencies
|
||||
for tool in ["cmake", "common", "ssl", "rtc"]:
|
||||
benv.Tool(tool, toolpath=["tools"])
|
||||
|
||||
ssl = benv.BuildOpenSSL()
|
||||
benv.NoCache(ssl) # Needs refactoring to properly cache generated headers.
|
||||
rtc = benv.BuildLibDataChannel()
|
||||
|
||||
benv.Depends(sources, [ssl, rtc])
|
||||
|
||||
# Make the shared library
|
||||
result_name = "webrtc_native{}{}".format(benv["suffix"], benv["SHLIBSUFFIX"])
|
||||
library = benv.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
|
||||
build_targets.append(library)
|
||||
|
||||
Default(build_targets)
|
||||
|
||||
# For macOS universal builds, join the libraries using lipo.
|
||||
if mac_universal:
|
||||
result_name = "libwebrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
|
||||
universal_target = env.Command(os.path.join(result_path, "lib", result_name), build_targets, "lipo $SOURCES -output $TARGETS -create")
|
||||
Default(universal_target)
|
||||
|
||||
# GDNativeLibrary
|
||||
if env["godot_version"] == "3":
|
||||
@@ -135,4 +172,5 @@ if env["godot_version"] == "3":
|
||||
})
|
||||
else:
|
||||
extfile = env.InstallAs(os.path.join(result_path, "webrtc.gdextension"), "misc/webrtc.gdextension")
|
||||
|
||||
Default(extfile)
|
||||
|
||||
Submodule godot-cpp updated: 151ea35c5f...9d1c396c54
@@ -6,8 +6,7 @@ entry_symbol = "webrtc_extension_init"
|
||||
|
||||
linux.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so"
|
||||
linux.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_32.so"
|
||||
macos.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.macos.template_debug.x86_64.dylib"
|
||||
macos.debug.arm64 = "res://webrtc/lib/libwebrtc_native.macos.template_debug.arm64.dylib"
|
||||
macos.debug = "res://webrtc/lib/libwebrtc_native.macos.template_debug.universal.dylib"
|
||||
windows.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_64.dll"
|
||||
windows.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_32.dll"
|
||||
android.debug.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.arm64.so"
|
||||
@@ -17,8 +16,7 @@ ios.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.x86_64.
|
||||
|
||||
linux.release.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_64.so"
|
||||
linux.release.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_32.so"
|
||||
macos.release.x86_64 = "res://webrtc/lib/libwebrtc_native.macos.template_release.x86_64.dylib"
|
||||
macos.release.arm64 = "res://webrtc/lib/libwebrtc_native.macos.template_release.arm64.dylib"
|
||||
macos.release = "res://webrtc/lib/libwebrtc_native.macos.template_release.universal.dylib"
|
||||
windows.release.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_64.dll"
|
||||
windows.release.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_32.dll"
|
||||
android.release.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_release.arm64.so"
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
[resource]
|
||||
singleton = true
|
||||
reloadable = false
|
||||
entry/OSX.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.x86_64.dylib"
|
||||
entry/OSX.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib"
|
||||
entry/OSX.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.macos.{TARGET}.universal.dylib"
|
||||
entry/Windows.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
|
||||
entry/Windows.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
|
||||
entry/X11.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
|
||||
@@ -16,11 +15,3 @@ entry/Android.x64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}
|
||||
entry/iOS.armv7 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.armv32.dylib"
|
||||
entry/iOS.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
|
||||
entry/iOS.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"
|
||||
dependency/Windows.64 = [ ]
|
||||
dependency/Windows.32 = [ ]
|
||||
dependency/X11.64 = [ ]
|
||||
dependency/X11.32 = [ ]
|
||||
dependency/Server.64 = [ ]
|
||||
dependency/Server.32 = [ ]
|
||||
dependency/Android.armeabi-v7a = [ ]
|
||||
dependency/Android.arm64-v8a = [ ]
|
||||
|
||||
@@ -136,17 +136,17 @@ bool WebRTCLibDataChannel::_is_ordered() const {
|
||||
return channel->reliability().unordered == false;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_id() const {
|
||||
int32_t WebRTCLibDataChannel::_get_id() const {
|
||||
ERR_FAIL_COND_V(!channel, -1);
|
||||
return channel->id().value_or(-1);
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_packet_life_time() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_packet_life_time() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->reliability().type == rtc::Reliability::Type::Timed ? std::get<std::chrono::milliseconds>(channel->reliability().rexmit).count() : -1;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_retransmits() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_retransmits() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->reliability().type == rtc::Reliability::Type::Rexmit ? std::get<int>(channel->reliability().rexmit) : -1;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ bool WebRTCLibDataChannel::_is_negotiated() const {
|
||||
return negotiated;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_buffered_amount() const {
|
||||
int32_t WebRTCLibDataChannel::_get_buffered_amount() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->bufferedAmount();
|
||||
}
|
||||
@@ -194,7 +194,7 @@ Error WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
|
||||
Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int32_t p_len) try {
|
||||
ERR_FAIL_COND_V(!channel, FAILED);
|
||||
ERR_FAIL_COND_V(channel->isClosed(), FAILED);
|
||||
if (write_mode == WRITE_MODE_TEXT) {
|
||||
@@ -212,11 +212,11 @@ Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len)
|
||||
ERR_FAIL_V(FAILED);
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_available_packet_count() const {
|
||||
int32_t WebRTCLibDataChannel::_get_available_packet_count() const {
|
||||
return packet_queue.size();
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_packet_size() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_packet_size() const {
|
||||
return 16384; // See RFC-8831 section 6.6: https://datatracker.ietf.org/doc/rfc8831/
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ public:
|
||||
|
||||
/* PacketPeer */
|
||||
virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) override;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) override;
|
||||
virtual int64_t _get_available_packet_count() const override;
|
||||
virtual int64_t _get_max_packet_size() const override;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) override;
|
||||
virtual int32_t _get_available_packet_count() const override;
|
||||
virtual int32_t _get_max_packet_size() const override;
|
||||
|
||||
/* WebRTCDataChannel */
|
||||
godot::Error _poll() override;
|
||||
@@ -94,12 +94,12 @@ public:
|
||||
ChannelState _get_ready_state() const override;
|
||||
godot::String _get_label() const override;
|
||||
bool _is_ordered() const override;
|
||||
int64_t _get_id() const override;
|
||||
int64_t _get_max_packet_life_time() const override;
|
||||
int64_t _get_max_retransmits() const override;
|
||||
int32_t _get_id() const override;
|
||||
int32_t _get_max_packet_life_time() const override;
|
||||
int32_t _get_max_retransmits() const override;
|
||||
godot::String _get_protocol() const override;
|
||||
bool _is_negotiated() const override;
|
||||
int64_t _get_buffered_amount() const override;
|
||||
int32_t _get_buffered_amount() const override;
|
||||
|
||||
WebRTCLibDataChannel();
|
||||
~WebRTCLibDataChannel();
|
||||
|
||||
@@ -234,7 +234,11 @@ Error WebRTCLibPeerConnection::_set_local_description(const String &p_type, cons
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef GDNATIVE_WEBRTC
|
||||
Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try {
|
||||
#else
|
||||
Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int32_t sdpMlineIndexName, const String &sdpName) try {
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
|
||||
rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data());
|
||||
peer_connection->addRemoteCandidate(candidate);
|
||||
|
||||
@@ -83,7 +83,11 @@ public:
|
||||
godot::Error _create_offer() override;
|
||||
godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) override;
|
||||
godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) override;
|
||||
#ifdef GDNATIVE_WEBRTC
|
||||
godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override;
|
||||
#else
|
||||
godot::Error _add_ice_candidate(const godot::String &sdpMidName, int32_t sdpMlineIndexName, const godot::String &sdpName) override;
|
||||
#endif
|
||||
godot::Error _poll() override;
|
||||
void _close() override;
|
||||
|
||||
|
||||
@@ -119,21 +119,21 @@ public:
|
||||
virtual ChannelState _get_ready_state() const = 0;
|
||||
virtual godot::String _get_label() const = 0;
|
||||
virtual bool _is_ordered() const = 0;
|
||||
virtual int64_t _get_id() const = 0;
|
||||
virtual int64_t _get_max_packet_life_time() const = 0;
|
||||
virtual int64_t _get_max_retransmits() const = 0;
|
||||
virtual int32_t _get_id() const = 0;
|
||||
virtual int32_t _get_max_packet_life_time() const = 0;
|
||||
virtual int32_t _get_max_retransmits() const = 0;
|
||||
virtual godot::String _get_protocol() const = 0;
|
||||
virtual bool _is_negotiated() const = 0;
|
||||
virtual int64_t _get_buffered_amount() const = 0;
|
||||
virtual int32_t _get_buffered_amount() const = 0;
|
||||
|
||||
virtual godot::Error _poll() = 0;
|
||||
virtual void _close() = 0;
|
||||
|
||||
/* PacketPeer */
|
||||
virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) = 0;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) = 0;
|
||||
virtual int64_t _get_available_packet_count() const = 0;
|
||||
virtual int64_t _get_max_packet_size() const = 0;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) = 0;
|
||||
virtual int32_t _get_available_packet_count() const = 0;
|
||||
virtual int32_t _get_max_packet_size() const = 0;
|
||||
|
||||
~WebRTCDataChannelNative();
|
||||
};
|
||||
|
||||
8
thirdparty/README.md
vendored
8
thirdparty/README.md
vendored
@@ -19,7 +19,7 @@ Module location:
|
||||
## libdatachannel
|
||||
|
||||
- Upstream: https://github.com/paullouisageneau/libdatachannel
|
||||
- Version: 0.18.1 (595f0ebaac3974f17e5a5c63e7e7dc0c5edd163d, 2022)
|
||||
- Version: 0.18.4 (4dd6c2117684c3d7d13c0d02b5aee8d4c2b661b0, 2023)
|
||||
- License: MPL 2.0
|
||||
|
||||
Module location:
|
||||
@@ -30,7 +30,7 @@ Module location:
|
||||
# libjuice
|
||||
|
||||
- Upstream: https://github.com/paullouisageneau/libjuice
|
||||
- Version: 1.1.0 (0dabc046cd23da6908749e4c6add834ec29a7c49, 2022)
|
||||
- Version: 1.2.3 (8c23cc88c6d41e5ccbc44ea0ad3d79b22cf02361, 2023)
|
||||
- License: MPL 2.0
|
||||
|
||||
Module location:
|
||||
@@ -41,7 +41,7 @@ Module location:
|
||||
## libsrtp
|
||||
|
||||
- Upstream: https://github.com/cisco/libsrtp
|
||||
- Version: 2.4.2 (90d05bf8980d16e4ac3f16c19b77e296c4bc207b, 2021)
|
||||
- Version: 2.5.0 (a566a9cfcd619e8327784aa7cff4a1276dc1e895, 2023)
|
||||
- License: BSD-3-Clause
|
||||
|
||||
Module location:
|
||||
@@ -52,7 +52,7 @@ Module location:
|
||||
## openssl
|
||||
|
||||
- Upstream: git://git.openssl.org/openssl.git
|
||||
- Version: 3.0.7 (19cc035b6c6f2283573d29c7ea7f7d675cf750ce, 2022)
|
||||
- Version: 3.0.8 (31157bc0b46e04227b8468d3e6915e4d0332777c, 2023)
|
||||
- License: Apache 2.0
|
||||
|
||||
Module location:
|
||||
|
||||
2
thirdparty/libdatachannel
vendored
2
thirdparty/libdatachannel
vendored
Submodule thirdparty/libdatachannel updated: 595f0ebaac...4dd6c21176
2
thirdparty/openssl
vendored
2
thirdparty/openssl
vendored
Submodule thirdparty/openssl updated: 19cc035b6c...31157bc0b4
@@ -52,6 +52,7 @@ def rtc_cmake_config(env):
|
||||
config["CMAKE_OSX_SYSROOT"] = "iphonesimulator"
|
||||
elif env["platform"] == "windows":
|
||||
config["CMAKE_SYSTEM_NAME"] = "Windows"
|
||||
config["BUILD_WITH_WARNINGS"] = "0" # Disables werror in libsrtp.
|
||||
return config
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user