Compare commits

..

34 Commits

Author SHA1 Message Date
Fabio Alessandrelli
0fc992e0d5 Merge pull request #76 from Faless/bump/beta9
Update to Godot 4.0 beta9
2022-12-19 22:11:33 +01:00
Fabio Alessandrelli
fbadff454c Update to Godot 4.0 beta9 2022-12-19 20:42:56 +01:00
Fabio Alessandrelli
61a6d25c47 Merge pull request #75 from Faless/bump/beta8
Bump godot-cpp to beta8, libdatachannel to v0.18.0
2022-12-10 18:26:25 +01:00
Fabio Alessandrelli
dfaad6f5ba Bump godot-cpp to beta8, libdatachannel to v0.18.0
libdatachannel and libjuice are now released under MPL 2.0.

Dependencies has been refactored under a `thirdparty` folder similar to
what we have in Godot, with a dedicated `thirdparty/README.md`
containing details information on dependencies upstreams, versions, and
licenses.
2022-12-10 17:13:59 +01:00
Fabio Alessandrelli
35bdd5efa7 Merge pull request #73 from Faless/bump/beta6
Update to Godot 4.0 beta6, and bump dependencies.
2022-11-28 20:19:47 +01:00
Fabio Alessandrelli
90aaa0b82e Update to libdatachannel v0.17.12+git. 2022-11-28 17:54:19 +01:00
Fabio Alessandrelli
16f311844b Update to OpenSSL 3.0.7. 2022-11-28 17:54:19 +01:00
Fabio Alessandrelli
dfb34df36e Update to Godot 4.0-beta6 2022-11-28 17:54:19 +01:00
Fabio Alessandrelli
9715e73ae4 Merge pull request #74 from Faless/build/cache_and_paths
[SCons] Fix caching and path detection.
2022-11-28 17:53:10 +01:00
Fabio Alessandrelli
2e9a25bb39 [SCons] Fix caching and path detection.
Add version file depenencies to SSL and RTC targets.

Disable OpenSSL caching since it causes issues as it doesn't properly
cache generated header files.

Add hack to prepend PATH and few other vars (should probably be added
to upstream godot-cpp), and clone scons envs when building ssl/rtc (so
that PATHs are properly setup).
2022-11-28 03:10:20 +01:00
Fabio Alessandrelli
6067addd96 Merge pull request #72 from JonathanPicques/patch-1
Rename osx to macos in webrtc.gdextension
2022-11-26 15:50:07 +01:00
Jonathan Picques
a3fbd33464 Rename osx to macos in webrtc.gdextension
The plugin wouldn't work with Godot beta 5 because it expects a macos key instead of an osx
2022-11-26 13:56:06 +01:00
Fabio Alessandrelli
d697901f81 Merge pull request #70 from Faless/bump/beta5
Update to Godot 4.0-beta5
2022-11-19 11:08:34 +01:00
Fabio Alessandrelli
3eb7d0aa3b Update to Godot 4.0-beta5 2022-11-19 01:43:24 +01:00
Fabio Alessandrelli
ecec40f59e Merge pull request #68 from Faless/bump/beta4
Update to Godot 4.0-beta4.
2022-11-15 00:41:01 +01:00
Fabio Alessandrelli
37a289addf Update to Godot 4.0-beta4. 2022-11-14 22:48:46 +01:00
Fabio Alessandrelli
1436024f59 Merge pull request #65 from Faless/bump/beta3
[Upstream] Update to Godot Beta 3
2022-10-17 22:42:33 +02:00
Fabio Alessandrelli
690b31e7dd [Upstream] Update to Godot beta 3.
Update build targets.
Move release script out of CI yaml.
Disable debug CI builds for Godot 3.x since they are mostly used for
debugging the extension itself.
2022-10-17 20:59:33 +02:00
Fabio Alessandrelli
9b0a5d8b46 [CI] Update actions, add cache for faster builds. 2022-10-16 16:15:42 +02:00
Fabio Alessandrelli
1769730ef0 Merge pull request #63 from Faless/bump/beta2
[CPP] Bump godot-cpp to beta2 headers.
2022-10-10 11:49:36 +02:00
Fabio Alessandrelli
04898f2714 [CPP] Bump godot-cpp to beta2 headers. 2022-10-09 19:42:31 +02:00
Fabio Alessandrelli
d7fc6cde3b Merge pull request #61 from Faless/bump/beta1
[Extension] Update to Godot 4.0 beta 1
2022-09-16 14:39:41 +02:00
Fabio Alessandrelli
1009e8bb1c Add methods to get gathering and signaling state. 2022-09-16 13:07:06 +02:00
Fabio Alessandrelli
5fd359f674 Bump godot-cpp to Godot 4.0 beta1. 2022-09-16 13:07:06 +02:00
Fabio Alessandrelli
822e0532c2 Merge pull request #60 from Faless/bump/alpha16
Update to Godot alpha16
2022-09-11 18:26:08 +02:00
Fabio Alessandrelli
d8cbd14a28 Disable android 32 bits builds. 2022-09-11 15:34:08 +02:00
Fabio Alessandrelli
6e52fce986 Update sources to alpha16 2022-09-11 15:34:08 +02:00
Fabio Alessandrelli
a93af67d75 [godot-cpp] Bump to alpha16. 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
22ee6435a1 Update to libdatachannel 0.17.10+git. 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
b5d8a72ef8 Update to OpenSSL 3.0.5 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
2ad1bf1716 Merge pull request #57 from Faless/bump/4.0_alpha11
Bump godot-cpp to alpha11.
2022-07-06 13:24:04 +02:00
Fabio Alessandrelli
e683c79938 Bump godot-cpp to alpha11. 2022-07-06 11:45:03 +02:00
Fabio Alessandrelli
426ca6cc8e Merge pull request #56 from Faless/fix/write_mode
Fix default data channel write mode to binary.
2022-06-19 13:48:20 +02:00
Fabio Alessandrelli
9b53ef3325 Fix default data channel write mode to binary.
It's the engine expected default, and the least surprising for the users
since it allows any data to be sent, while text mode requires valid UTF.
2022-06-19 12:18:49 +02:00
23 changed files with 389 additions and 193 deletions

View File

@@ -1,13 +1,17 @@
name: 🔧 Build -> Package 📦
on: [push, pull_request]
env:
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: master
jobs:
static-checks:
name: 📊 Static Checks (clang-format, black format, file format)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install dependencies
run: |
@@ -37,39 +41,32 @@ jobs:
matrix:
include:
# Android
- platform: android
arch: 'x86_32'
gdnative_flags: 'android_arch=x86'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android
arch: 'x86_64'
gdnative_flags: 'android_arch=x86_64'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android
arch: 'arm32'
gdnative_flags: 'android_arch=armv7'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: android-x86_64
- platform: android
arch: 'arm64'
gdnative_flags: 'android_arch=arm64v8'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: android-arm64
# iOS
- platform: ios
arch: 'x86_64'
gdnative_flags: 'ios_arch=x86_64'
sconsflags: 'ios_simulator=true'
os: 'macos-latest'
os: 'macos-11'
cache-name: ios-x86_64-simulator
- platform: ios
arch: 'arm64'
gdnative_flags: 'ios_arch=arm64'
sconsflags: ''
os: 'macos-11'
cache-name: ios-arm64
# Linux
- platform: linux
@@ -77,23 +74,27 @@ jobs:
gdnative_flags: 'bits=32'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: linux-x86_32
- platform: linux
arch: 'x86_64'
gdnative_flags: 'bits=64'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: linux-x86_64
# macOS
- platform: osx
- platform: macos
arch: 'x86_64'
gdnative_flags: 'macos_arch=x86_64 bits=64'
sconsflags: ''
os: 'macos-11'
- platform: osx
cache-name: macos-x86_64
- platform: macos
gdnative_flags: 'macos_arch=arm64 bits=64'
arch: 'arm64'
sconsflags: ''
os: 'macos-11'
cache-name: macos-arm64
# Windows
- platform: windows
@@ -102,14 +103,17 @@ jobs:
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64_x86
cache-name: win-x86_32
- platform: windows
arch: 'x86_64'
gdnative_flags: 'bits=64'
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64
cache-name: win-x86_64
env:
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} --jobs=2
defaults:
@@ -117,10 +121,16 @@ jobs:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
- name: Install Windows build dependencies
if: ${{ matrix.platform == 'windows' }}
run: |
@@ -139,7 +149,7 @@ jobs:
sudo apt-get install build-essential gcc-multilib g++-multilib
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'
@@ -152,33 +162,31 @@ jobs:
scons --version
cmake --version
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
- name: Compile Extension - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=debug generate_bindings=yes
scons target=template_debug generate_bindings=yes
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
- name: Compile Extension - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=release
scons target=template_release
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
- uses: actions/upload-artifact@v3
with:
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
path: bin/*
path: |
bin/
!bin/thirdparty/
package:
name: 📦 Package
needs: build
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
@@ -189,37 +197,24 @@ jobs:
- name: Bundle licenses.
run: |
cp LICENSE artifacts/LICENSE.webrtc-native
cp deps/libdatachannel/LICENSE artifacts/LICENSE.libdatachannel
cp deps/openssl/LICENSE.txt artifacts/LICENSE.openssl
cp deps/libdatachannel/deps/libjuice/LICENSE artifacts/LICENSE.libjuice
cp deps/libdatachannel/deps/usrsctp/LICENSE.md artifacts/LICENSE.usrsctp
cp deps/libdatachannel/deps/libsrtp/LICENSE artifacts/LICENSE.libsrtp
cp deps/libdatachannel/deps/json/LICENSE.MIT artifacts/LICENSE.json
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
cp thirdparty/libdatachannel/LICENSE artifacts/LICENSE.libdatachannel
cp thirdparty/openssl/LICENSE.txt artifacts/LICENSE.openssl
cp thirdparty/libdatachannel/deps/libjuice/LICENSE artifacts/LICENSE.libjuice
cp thirdparty/libdatachannel/deps/usrsctp/LICENSE.md artifacts/LICENSE.usrsctp
cp thirdparty/libdatachannel/deps/libsrtp/LICENSE artifacts/LICENSE.libsrtp
cp thirdparty/libdatachannel/deps/json/LICENSE.MIT artifacts/LICENSE.json
cp thirdparty/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
- name: Package artifacts for release
env:
DESTINATION: "release"
run: |
mkdir release
cd release
ls -R
VERSION="extension" TYPE="webrtc" ./misc/scripts/package_release.sh
VERSION="gdnative" TYPE="webrtc" ./misc/scripts/package_release.sh
for version in extension gdnative
do
for name in webrtc webrtc_debug
do
destdir="${version}/${name}"
mkdir -p ${destdir}/lib
find ../artifacts -wholename "*/${destdir}/lib/*" | xargs cp -t ${destdir}/lib/
find ../artifacts -wholename "*/${destdir}/${name}.tres" -or -wholename "*/${destdir}/${name}.gdextension" | head -n 1 | xargs cp -t ${destdir}/
find ../artifacts -wholename "*/LICENSE*" | xargs cp -t ${destdir}/
cd ${version}
zip -r ../godot-${version}-${name}.zip ${name}
cd ..
done
done
ls -R
ls -R release
- uses: actions/upload-artifact@v3
with:

4
.gitmodules vendored
View File

@@ -5,8 +5,8 @@
path = godot-cpp
url = https://github.com/godotengine/godot-cpp.git
[submodule "libdatachannel"]
path = deps/libdatachannel
path = thirdparty/libdatachannel
url = https://github.com/paullouisageneau/libdatachannel.git
[submodule "openssl"]
path = deps/openssl
path = thirdparty/openssl
url = https://github.com/openssl/openssl.git

View File

@@ -45,6 +45,4 @@ You simply need to copy that folder to the root folder of your project. Note tha
### License
The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and one of its dependencies (`libjuice`) are licensed under LGPLv2.1 or later, see [libdatachannel LICENSE](https://github.com/paullouisageneau/libdatachannel/blob/master/LICENSE) and [libjuice LICENSE](https://github.com/paullouisageneau/libjuice/blob/master/LICENSE).
Make sure you understand and comply with the LGPLv2.1 license when redistributing this plugin.
The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and its dependencies are licensed under other permissive open source licences. Please see [`thirdparty/README.md`](thirdparty/README.md) for more informations.

View File

@@ -23,6 +23,14 @@ opts.Add(EnumVariable("godot_version", "The Godot target version", "4", ["3", "4
opts.Update(env)
if env["godot_version"] == "3":
if "platform" in ARGUMENTS and ARGUMENTS["platform"] == "macos":
ARGUMENTS["platform"] = "osx" # compatibility with old osx name
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None:
CacheDir(scons_cache_path)
Decider("MD5")
env = SConscript("godot-cpp-3.x/SConstruct")
# Patch base env
@@ -41,11 +49,15 @@ if env["godot_version"] == "3":
if env["platform"] == "windows" and env["use_mingw"]:
env.Append(LINKFLAGS=["-static-libgcc"])
if env["platform"] == "osx":
env["platform"] = "macos" # compatibility with old osx name
ARGUMENTS["platform"] = "macos"
# Normalize suffix
if env["platform"] in ["windows", "linux"]:
env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64"
env["arch_suffix"] = env["arch"]
elif env["platform"] == "osx":
elif env["platform"] == "macos":
env["arch"] = env["macos_arch"]
env["arch_suffix"] = env["arch"]
elif env["platform"] == "ios":
@@ -59,13 +71,22 @@ if env["godot_version"] == "3":
"x86_64": "x86_64",
}[env["android_arch"]]
env["arch_suffix"] = env["arch"]
target_compat = "template_" + env["target"]
env["suffix"] = ".{}.{}.{}".format(env["platform"], target_compat, env["arch_suffix"])
env["debug_symbols"] = False
else:
env = SConscript("godot-cpp/SConstruct")
replace_flags(env["CCFLAGS"], {
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",
"-miphoneos-version-min=10.0": "-miphoneos-version-min=11.0",
})
env = env.Clone()
ARGUMENTS["ios_min_version"] = "11.0"
env = SConscript("godot-cpp/SConstruct").Clone()
# Should probably go to upstream godot-cpp.
# We let SCons build its default ENV as it includes OS-specific things which we don't
# want to have to pull in manually.
# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
env.PrependENVPath("PATH", os.getenv("PATH"))
env.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
if "TERM" in os.environ: # Used for colored output.
env["ENV"]["TERM"] = os.environ["TERM"]
# Patch mingw SHLIBSUFFIX.
if env["platform"] == "windows" and env["use_mingw"]:
@@ -74,10 +95,12 @@ if env["platform"] == "windows" and env["use_mingw"]:
opts.Update(env)
target = env["target"]
result_path = os.path.join("bin", "gdnative" if env["godot_version"] == "3" else "extension", "webrtc" if env["target"] == "release" else "webrtc_debug")
if env["godot_version"] == "3":
result_path = os.path.join("bin", "gdnative", "webrtc" if env["target"] == "release" else "webrtc_debug")
else:
result_path = os.path.join("bin", "extension", "webrtc")
# Dependencies
deps_source_dir = "deps"
env.Append(BUILDERS={
"BuildOpenSSL": env.Builder(action=builders.ssl_action, emitter=builders.ssl_emitter),
"BuildLibDataChannel": env.Builder(action=builders.rtc_action, emitter=builders.rtc_emitter),
@@ -85,20 +108,24 @@ env.Append(BUILDERS={
# SSL
ssl = env.BuildOpenSSL(env.Dir(builders.get_ssl_build_dir(env)), env.Dir(builders.get_ssl_source_dir(env)))
env.Depends(ssl, [env.File("builders.py"), env.File(builders.get_ssl_source_dir(env) + "/VERSION.dat")])
env.NoCache(ssl) # Needs refactoring to properly cache generated headers.
env.Prepend(CPPPATH=[builders.get_ssl_include_dir(env)])
env.Prepend(LIBPATH=[builders.get_ssl_build_dir(env)])
env.Append(LIBS=[ssl])
env.Append(LIBS=[builders.get_ssl_libs(env)])
# RTC
rtc = env.BuildLibDataChannel(env.Dir(builders.get_rtc_build_dir(env)), [env.Dir(builders.get_rtc_source_dir(env))] + ssl)
env.Depends(rtc, [env.File("builders.py"), env.File(builders.get_rtc_source_dir(env) + "/CMakeLists.txt")])
env.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
env.Prepend(LIBS=[rtc])
env.Prepend(LIBS=[builders.get_rtc_libs(env)])
# Our includes and sources
env.Append(CPPPATH=["src/"])
env.Append(CPPDEFINES=["RTC_STATIC"])
sources = []
sources.append(
[
@@ -113,10 +140,10 @@ else:
sources.append("src/init_gdnative.cpp")
add_sources(sources, "src/net/", "cpp")
env.Depends(sources, [ssl, rtc])
env.Depends(sources, [builders.get_ssl_libs(env), builders.get_rtc_libs(env)])
# Make the shared library
result_name = "webrtc_native.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"])
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
env.Depends(sources, ssl)
if env["platform"] == "windows" and env["use_mingw"]:
@@ -126,12 +153,13 @@ library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name)
Default(library)
# GDNativeLibrary
gdnlib = "webrtc"
if target != "release":
gdnlib += "_debug"
ext = ".tres" if env["godot_version"] == "3" else ".gdextension"
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
"{GDNATIVE_PATH}": gdnlib,
"{TARGET}": env["target"],
})
if env["godot_version"] == "3":
gdnlib = "webrtc" if target != "debug" else "webrtc_debug"
ext = ".tres"
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
"{GDNATIVE_PATH}": gdnlib,
"{TARGET}": "template_" + env["target"],
})
else:
extfile = env.InstallAs(os.path.join(result_path, "webrtc.gdextension"), "misc/webrtc.gdextension")
Default(extfile)

View File

@@ -1,4 +1,5 @@
import os
from SCons.Defaults import Mkdir
from SCons.Script import Environment
@@ -7,11 +8,11 @@ def get_android_api(env):
def get_deps_dir(env):
return env.Dir("#deps").abspath
return env.Dir("#thirdparty").abspath
def get_deps_build_dir(env):
return get_deps_dir(env) + "/build/{}.{}.{}.dir".format(env["platform"], env["target"], env["arch_suffix"])
return env.Dir("#bin/thirdparty").abspath + "/{}.{}.dir".format(env["suffix"][1:], "RelWithDebInfo" if env["debug_symbols"] else "Release")
def get_rtc_source_dir(env):
@@ -26,6 +27,17 @@ def get_rtc_include_dir(env):
return get_rtc_source_dir(env) + "/include"
def get_rtc_libs(env):
bdir = get_rtc_build_dir(env)
libs = [
"libdatachannel-static.a",
"deps/libjuice/libjuice-static.a",
"deps/libsrtp/libsrtp2.a",
"deps/usrsctp/usrsctplib/libusrsctp.a"
]
return [env.File(bdir + "/" + lib) for lib in libs]
def get_ssl_source_dir(env):
return get_deps_dir(env) + "/openssl"
@@ -42,19 +54,20 @@ def get_ssl_include_dir(env):
return get_ssl_install_dir(env) + "/include"
def get_ssl_libs(env):
bdir = get_ssl_build_dir(env)
return [env.File(bdir + "/" + lib) for lib in ["libssl.a", "libcrypto.a"]]
def ssl_emitter(target, source, env):
build_dir = get_ssl_build_dir(env)
libs = ["libssl.a", "libcrypto.a"]
install_dir = get_ssl_install_dir(env)
ssl_include = os.path.join(source[0].abspath, "include")
return [env.File(build_dir + "/" + l) for l in libs], source
return get_ssl_libs(env), source
def ssl_action(target, source, env):
build_dir = get_ssl_build_dir(env)
source_dir = source[0].abspath
ssl_env = Environment()
ssl_env = env.Clone()
install_dir = get_ssl_install_dir(env)
args = [
"no-ssl3",
@@ -63,7 +76,7 @@ def ssl_action(target, source, env):
"--prefix=%s" % install_dir,
"--openssldir=%s" % install_dir,
]
if env["target"] == "debug":
if env["debug_symbols"]:
args.append("-d")
if env["platform"] != "windows":
@@ -88,7 +101,7 @@ def ssl_action(target, source, env):
ssl_env.PrependENVPath("PATH", os.path.dirname(env["CC"]))
ssl_env["ENV"]["ANDROID_NDK_ROOT"] = os.environ.get("ANDROID_NDK_ROOT", "")
elif env["platform"] == "osx":
elif env["platform"] == "macos":
if env["arch"] == "x86_64":
args.extend(["darwin64-x86_64"])
elif env["arch"] == "arm64":
@@ -126,8 +139,8 @@ def ssl_action(target, source, env):
jobs = env.GetOption("num_jobs")
ssl_env.Execute([
"mkdir -p " + build_dir, # TODO python?
("cd %s && %s/Configure " % (build_dir, source_dir)) + " ".join(args),
Mkdir(build_dir),
"cd %s && perl %s/Configure %s" % (build_dir, source_dir, " ".join(['"%s"' % a for a in args])),
"make -C %s -j%s" % (build_dir, jobs),
"make -C %s install_sw install_ssldirs -j%s" % (build_dir, jobs),
]
@@ -136,34 +149,26 @@ def ssl_action(target, source, env):
def rtc_emitter(target, source, env):
build_dir = get_rtc_build_dir(env)
libs = ["libdatachannel-static.a", "libjuice-static.a", "libsrtp2.a", "libusrsctp.a"]
lib_paths = [
build_dir,
os.path.join(build_dir, "deps/libjuice"),
os.path.join(build_dir, "deps/libsrtp"),
os.path.join(build_dir, "deps/usrsctp/usrsctplib"),
]
return [env.File(lib_paths[i] + "/" + libs[i]) for i in range(len(libs))], source
return get_rtc_libs(env), source
def rtc_action(target, source, env):
build_dir = get_rtc_build_dir(env)
source_dir = source[0].abspath
args = [
"cmake",
"-B",
build_dir,
"-DUSE_NICE=0",
"-DNO_WEBSOCKET=1",
#"-DNO_MEDIA=1", # Windows builds fail without it.
"-DNO_EXAMPLES=1",
"-DNO_WEBSOCKET=1",
"-DNO_TESTS=1",
"-DOPENSSL_USE_STATIC_LIBS=1",
"-DOPENSSL_INCLUDE_DIR=%s" % get_ssl_include_dir(env),
"-DOPENSSL_SSL_LIBRARY=%s/libssl.a" % get_ssl_build_dir(env),
"-DOPENSSL_CRYPTO_LIBRARY=%s/libcrypto.a" % get_ssl_build_dir(env),
"-DCMAKE_BUILD_TYPE=%s" % ("Release" if env["target"] == "release" else "Debug"),
"-DCMAKE_BUILD_TYPE=%s" % ("RelWithDebInfo" if env["debug_symbols"] else "Release"),
]
if env["platform"] == "android":
abi = {
@@ -191,7 +196,7 @@ def rtc_action(target, source, env):
"-DCMAKE_C_FLAGS=-m64",
"-DCMAKE_CXX_FLAGS=-m64"
])
elif env["platform"] == "osx":
elif env["platform"] == "macos":
if env["macos_deployment_target"] != "default":
args.extend(["-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % env["macos_deployment_target"]])
if env["arch"] == "x86_64":
@@ -215,7 +220,8 @@ def rtc_action(target, source, env):
if env["arch"] == "x86_32":
if env["use_mingw"]:
args.extend([
"-G 'Unix Makefiles'",
"-G",
"Unix Makefiles",
"-DCMAKE_C_COMPILER=i686-w64-mingw32-gcc",
"-DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++",
"-DCMAKE_SYSTEM_NAME=Windows",
@@ -223,7 +229,8 @@ def rtc_action(target, source, env):
else:
if env["use_mingw"]:
args.extend([
"-G 'Unix Makefiles'",
"-G",
"Unix Makefiles",
"-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc",
"-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++",
"-DCMAKE_SYSTEM_NAME=Windows"
@@ -231,10 +238,10 @@ def rtc_action(target, source, env):
args.append(source_dir)
jobs = env.GetOption("num_jobs")
rtc_env = Environment()
rtc_env = env.Clone()
rtc_env.Execute([
"cmake " + " ".join(args),
"cmake --build %s -t datachannel-static -j%s" % (build_dir, jobs),
" ".join(['"%s"' % a for a in args]),
"cmake --build %s -t datachannel-static -j%s" % (build_dir, jobs)
]
)
return None

1
deps/libdatachannel vendored

Submodule deps/libdatachannel deleted from 59cc9f214c

1
deps/openssl vendored

Submodule deps/openssl deleted from 4d346a188c

32
misc/scripts/package_release.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -e
set -x
ARTIFACTS=${ARTIFACTS:-"artifacts"}
DESTINATION=${DESTIONATION:-"release"}
VERSION=${VERSION:-"extension"}
TYPE=${TYPE:-"webrtc"}
mkdir -p ${DESTINATION}
ls -R ${DESTINATION}
DESTDIR="${DESTINATION}/${VERSION}/${TYPE}"
mkdir -p ${DESTDIR}/lib
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/lib/*" | xargs cp -t "${DESTDIR}/lib/"
find "${ARTIFACTS}" -wholename "*/LICENSE*" | xargs cp -t "${DESTDIR}/"
if [ $VERSION = "extension" ]; then
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.gdextension" | head -n 1 | xargs cp -t "${DESTDIR}/"
else
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.tres" | head -n 1 | xargs cp -t "${DESTDIR}/"
fi
CURDIR=$(pwd)
cd "${DESTINATION}/${VERSION}"
zip -r ../godot-${VERSION}-${TYPE}.zip ${TYPE}
cd "$CURDIR"
ls -R ${DESTINATION}

View File

@@ -4,15 +4,24 @@ entry_symbol = "webrtc_extension_init"
[libraries]
linux.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
linux.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
osx.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.x86_64.dylib"
osx.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib"
windows.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
windows.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
android.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
android.arm32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm32.so"
android.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
android.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_32.so"
ios.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
ios.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"
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"
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"
android.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.x86_64.so"
ios.debug.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.arm64.dylib"
ios.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.x86_64.simulator.dylib"
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"
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"
android.release.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_release.x86_64.so"
ios.release.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.arm64.dylib"
ios.release.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.x86_64.simulator.dylib"

View File

@@ -11,10 +11,8 @@ entry/X11.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64
entry/X11.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
entry/Server.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
entry/Server.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
entry/Android.armeabi-v7a = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm32.so"
entry/Android.arm64-v8a = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
entry/Android.x64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
entry/Android.x86 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_32.so"
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"

View File

@@ -33,10 +33,10 @@
#ifdef GDNATIVE_WEBRTC
#include "GDNativeLibrary.hpp"
#include "NativeScript.hpp"
#define ERR_UNAVAILABLE GODOT_ERR_UNAVAILABLE
#define FAILED GODOT_FAILED
#define ERR_INVALID_PARAMETER GODOT_ERR_INVALID_PARAMETER
#define OK GODOT_OK
#define ERR_UNAVAILABLE Error::ERR_UNAVAILABLE
#define FAILED Error::FAILED
#define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
#define OK Error::OK
#endif
#include <stdio.h>
@@ -108,12 +108,12 @@ void WebRTCLibDataChannel::queue_packet(const uint8_t *data, uint32_t size, bool
mutex->unlock();
}
void WebRTCLibDataChannel::_set_write_mode(int64_t p_mode) {
void WebRTCLibDataChannel::_set_write_mode(WriteMode p_mode) {
ERR_FAIL_COND(p_mode != WRITE_MODE_TEXT && p_mode != WRITE_MODE_BINARY);
write_mode = (WriteMode)p_mode;
write_mode = p_mode;
}
int64_t WebRTCLibDataChannel::_get_write_mode() const {
WebRTCDataChannel::WriteMode WebRTCLibDataChannel::_get_write_mode() const {
return write_mode;
}
@@ -121,7 +121,7 @@ bool WebRTCLibDataChannel::_was_string_packet() const {
return current_packet.second;
}
int64_t WebRTCLibDataChannel::_get_ready_state() const {
WebRTCDataChannel::ChannelState WebRTCLibDataChannel::_get_ready_state() const {
ERR_FAIL_COND_V(!channel, STATE_CLOSED);
return channel_state;
}
@@ -166,7 +166,7 @@ int64_t WebRTCLibDataChannel::_get_buffered_amount() const {
return channel->bufferedAmount();
}
int64_t WebRTCLibDataChannel::_poll() {
Error WebRTCLibDataChannel::_poll() {
return OK;
}
@@ -177,7 +177,7 @@ void WebRTCLibDataChannel::_close() try {
} catch (...) {
}
int64_t WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len) {
Error WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len) {
ERR_FAIL_COND_V(packet_queue.empty(), ERR_UNAVAILABLE);
mutex->lock();
@@ -191,10 +191,10 @@ int64_t WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_l
mutex->unlock();
return 0;
return OK;
}
int64_t WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
ERR_FAIL_COND_V(!channel, FAILED);
ERR_FAIL_COND_V(channel->isClosed(), FAILED);
if (write_mode == WRITE_MODE_TEXT) {

View File

@@ -40,6 +40,9 @@
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
#endif
#else
#include <godot_cpp/core/binder_common.hpp>
#include <godot_cpp/classes/global_constants_binds.hpp>
#include <godot_cpp/classes/web_rtc_data_channel_extension.hpp>
#endif
@@ -61,7 +64,7 @@ private:
QueuedPacket current_packet;
std::shared_ptr<rtc::DataChannel> channel = nullptr;
WriteMode write_mode = WRITE_MODE_TEXT;
WriteMode write_mode = WRITE_MODE_BINARY;
ChannelState channel_state = STATE_CONNECTING;
bool negotiated = false;
@@ -75,20 +78,20 @@ public:
static WebRTCLibDataChannel *new_data_channel(std::shared_ptr<rtc::DataChannel> p_channel, bool p_negotiated);
/* PacketPeer */
virtual int64_t _get_packet(const uint8_t **r_buffer, int32_t *r_len) override;
virtual int64_t _put_packet(const uint8_t *p_buffer, int64_t p_len) override;
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;
/* WebRTCDataChannel */
int64_t _poll() override;
godot::Error _poll() override;
void _close() override;
void _set_write_mode(int64_t p_mode) override;
int64_t _get_write_mode() const override;
void _set_write_mode(WriteMode p_mode) override;
WriteMode _get_write_mode() const override;
bool _was_string_packet() const override;
int64_t _get_ready_state() const override;
ChannelState _get_ready_state() const override;
godot::String _get_label() const override;
bool _is_ordered() const override;
int64_t _get_id() const override;

View File

@@ -35,24 +35,10 @@ using namespace godot;
using namespace godot_webrtc;
#ifdef GDNATIVE_WEBRTC
struct CastableError {
godot::Error err_enum;
int64_t err_int;
operator int64_t() { return err_int; }
operator godot::Error() { return err_enum; }
CastableError(godot::Error p_enum, int64_t p_int) {
err_enum = p_enum;
err_int = p_int;
}
};
#define MKERR(m_err) CastableError(godot::Error::m_err, GODOT_##m_err)
#define OK MKERR(OK)
#define FAILED MKERR(FAILED)
#define ERR_UNCONFIGURED MKERR(ERR_UNCONFIGURED)
#define ERR_UNAVAILABLE MKERR(ERR_UNAVAILABLE)
#define ERR_INVALID_PARAMETER MKERR(ERR_INVALID_PARAMETER)
#define ERR_BUG MKERR(ERR_BUG)
#define OK Error::OK
#define FAILED Error::FAILED
#define ERR_UNCONFIGURED Error::ERR_UNCONFIGURED
#define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
#endif
void WebRTCLibPeerConnection::initialize_signaling() {
@@ -124,7 +110,7 @@ Error WebRTCLibPeerConnection::_parse_channel_config(rtc::DataChannelInit &r_con
return OK;
}
int64_t WebRTCLibPeerConnection::_get_connection_state() const {
WebRTCPeerConnection::ConnectionState WebRTCLibPeerConnection::_get_connection_state() const {
ERR_FAIL_COND_V(peer_connection == nullptr, STATE_CLOSED);
rtc::PeerConnection::State state = peer_connection->state();
@@ -144,7 +130,43 @@ int64_t WebRTCLibPeerConnection::_get_connection_state() const {
}
}
int64_t WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
WebRTCLibPeerConnection::GatheringState WebRTCLibPeerConnection::_get_gathering_state() const {
ERR_FAIL_COND_V(peer_connection == nullptr, GATHERING_STATE_NEW);
rtc::PeerConnection::GatheringState state = peer_connection->gatheringState();
switch (state) {
case rtc::PeerConnection::GatheringState::New:
return GATHERING_STATE_NEW;
case rtc::PeerConnection::GatheringState::InProgress:
return GATHERING_STATE_GATHERING;
case rtc::PeerConnection::GatheringState::Complete:
return GATHERING_STATE_COMPLETE;
default:
return GATHERING_STATE_NEW;
}
}
WebRTCLibPeerConnection::SignalingState WebRTCLibPeerConnection::_get_signaling_state() const {
ERR_FAIL_COND_V(peer_connection == nullptr, SIGNALING_STATE_CLOSED);
rtc::PeerConnection::SignalingState state = peer_connection->signalingState();
switch (state) {
case rtc::PeerConnection::SignalingState::Stable:
return SIGNALING_STATE_STABLE;
case rtc::PeerConnection::SignalingState::HaveLocalOffer:
return SIGNALING_STATE_HAVE_LOCAL_OFFER;
case rtc::PeerConnection::SignalingState::HaveRemoteOffer:
return SIGNALING_STATE_HAVE_REMOTE_OFFER;
case rtc::PeerConnection::SignalingState::HaveLocalPranswer:
return SIGNALING_STATE_HAVE_LOCAL_PRANSWER;
case rtc::PeerConnection::SignalingState::HaveRemotePranswer:
return SIGNALING_STATE_HAVE_REMOTE_PRANSWER;
default:
return SIGNALING_STATE_CLOSED;
}
}
Error WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
rtc::Configuration config = {};
if (p_config.has("iceServers") && p_config["iceServers"].get_type() == Variant::ARRAY) {
Array servers = p_config["iceServers"];
@@ -155,7 +177,7 @@ int64_t WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
ERR_FAIL_COND_V(err != OK, FAILED);
}
}
return (int64_t)_create_pc(config);
return _create_pc(config);
}
Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try {
@@ -178,7 +200,7 @@ Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, c
ERR_FAIL_V(nullptr);
}
int64_t WebRTCLibPeerConnection::_create_offer() try {
Error WebRTCLibPeerConnection::_create_offer() try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
ERR_FAIL_COND_V(_get_connection_state() != STATE_NEW, FAILED);
peer_connection->setLocalDescription(rtc::Description::Type::Offer);
@@ -188,7 +210,7 @@ int64_t WebRTCLibPeerConnection::_create_offer() try {
ERR_FAIL_V(FAILED);
}
int64_t WebRTCLibPeerConnection::_set_remote_description(const String &p_type, const String &p_sdp) try {
Error WebRTCLibPeerConnection::_set_remote_description(const String &p_type, const String &p_sdp) try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
std::string sdp(p_sdp.utf8().get_data());
std::string type(p_type.utf8().get_data());
@@ -204,7 +226,7 @@ int64_t WebRTCLibPeerConnection::_set_remote_description(const String &p_type, c
ERR_FAIL_V(FAILED);
}
int64_t WebRTCLibPeerConnection::_set_local_description(const String &p_type, const String &p_sdp) {
Error WebRTCLibPeerConnection::_set_local_description(const String &p_type, const String &p_sdp) {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
// XXX Library quirk. It doesn't seem possible to create offers/answers without setting the local description.
// Ignore this call for now to avoid crash (it's already set automatically!).
@@ -212,7 +234,7 @@ int64_t WebRTCLibPeerConnection::_set_local_description(const String &p_type, co
return OK;
}
int64_t WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try {
Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data());
peer_connection->addRemoteCandidate(candidate);
@@ -222,7 +244,7 @@ int64_t WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, in
ERR_FAIL_V(FAILED);
}
int64_t WebRTCLibPeerConnection::_poll() {
Error WebRTCLibPeerConnection::_poll() {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
while (!signal_queue.empty()) {

View File

@@ -40,6 +40,9 @@
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
#endif
#else
#include <godot_cpp/core/binder_common.hpp>
#include <godot_cpp/classes/global_constants_binds.hpp>
#include <godot_cpp/classes/web_rtc_peer_connection_extension.hpp>
#endif
@@ -71,15 +74,17 @@ public:
void _init();
int64_t _get_connection_state() const override;
ConnectionState _get_connection_state() const override;
GatheringState _get_gathering_state() const override;
SignalingState _get_signaling_state() const override;
int64_t _initialize(const godot::Dictionary &p_config) override;
godot::Error _initialize(const godot::Dictionary &p_config) override;
godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override;
int64_t _create_offer() override;
int64_t _set_remote_description(const godot::String &type, const godot::String &sdp) override;
int64_t _set_local_description(const godot::String &type, const godot::String &sdp) override;
int64_t _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override;
int64_t _poll() override;
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;
godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override;
godot::Error _poll() override;
void _close() override;
WebRTCLibPeerConnection();

View File

@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <godot/gdnative_interface.h>
#include <gdextension_interface.h>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/defs.hpp>
@@ -66,7 +66,7 @@ void unregister_webrtc_extension_types(ModuleInitializationLevel p_level) {
}
extern "C" {
GDNativeBool GDN_EXPORT webrtc_extension_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
GDExtensionBool GDE_EXPORT webrtc_extension_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
init_obj.register_initializer(register_webrtc_extension_types);

View File

@@ -72,7 +72,7 @@ godot_int get_max_packet_size_wdc(const void *user) {
}
void set_write_mode_wdc(void *user, godot_int write_mode) {
((WebRTCDataChannelNative *)user)->_set_write_mode(write_mode);
((WebRTCDataChannelNative *)user)->_set_write_mode((godot::WebRTCDataChannel::WriteMode)write_mode);
}
godot_int get_write_mode_wdc(const void *user) {

View File

@@ -112,11 +112,11 @@ public:
void _init();
void register_interface(const godot_net_webrtc_data_channel *interface);
virtual void _set_write_mode(int64_t mode) = 0;
virtual int64_t _get_write_mode() const = 0;
virtual void _set_write_mode(WriteMode mode) = 0;
virtual WriteMode _get_write_mode() const = 0;
virtual bool _was_string_packet() const = 0;
virtual int64_t _get_ready_state() const = 0;
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;
@@ -126,12 +126,12 @@ public:
virtual bool _is_negotiated() const = 0;
virtual int64_t _get_buffered_amount() const = 0;
virtual int64_t _poll() = 0;
virtual godot::Error _poll() = 0;
virtual void _close() = 0;
/* PacketPeer */
virtual int64_t _get_packet(const uint8_t **r_buffer, int32_t *r_len) = 0;
virtual int64_t _put_packet(const uint8_t *p_buffer, int64_t p_len) = 0;
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;

View File

@@ -75,21 +75,38 @@ protected:
};
public:
enum GatheringState {
GATHERING_STATE_NEW,
GATHERING_STATE_GATHERING,
GATHERING_STATE_COMPLETE,
};
enum SignalingState {
SIGNALING_STATE_STABLE,
SIGNALING_STATE_HAVE_LOCAL_OFFER,
SIGNALING_STATE_HAVE_REMOTE_OFFER,
SIGNALING_STATE_HAVE_LOCAL_PRANSWER,
SIGNALING_STATE_HAVE_REMOTE_PRANSWER,
SIGNALING_STATE_CLOSED,
};
static void _register_methods();
static const godot_gdnative_ext_net_3_2_api_struct *_net_api;
void _init();
void register_interface(const godot_net_webrtc_peer_connection *interface);
virtual int64_t _get_connection_state() const = 0;
virtual ConnectionState _get_connection_state() const = 0;
virtual GatheringState _get_gathering_state() const = 0;
virtual SignalingState _get_signaling_state() const = 0;
virtual int64_t _initialize(const godot::Dictionary &p_config) = 0;
virtual godot::Error _initialize(const godot::Dictionary &p_config) = 0;
virtual godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) = 0;
virtual int64_t _create_offer() = 0;
virtual int64_t _set_remote_description(const godot::String &type, const godot::String &sdp) = 0;
virtual int64_t _set_local_description(const godot::String &type, const godot::String &sdp) = 0;
virtual int64_t _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) = 0;
virtual int64_t _poll() = 0;
virtual godot::Error _create_offer() = 0;
virtual godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) = 0;
virtual godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) = 0;
virtual godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) = 0;
virtual godot::Error _poll() = 0;
virtual void _close() = 0;
~WebRTCPeerConnectionNative();

82
thirdparty/README.md vendored Normal file
View File

@@ -0,0 +1,82 @@
# Third party libraries
Please keep categories (`##` level) listed alphabetically and matching their
respective folder names. Use two empty lines to separate categories for
readability.
## json
- Upstream: https://github.com/nlohmann/json
- Version: 3.10.5 (4f8fba14066156b73f1189a2b8bd568bde5284c5, 2022)
- License: MIT
Module location:
- thirdparty/libdatachannel/deps/json
## libdatachannel
- Upstream: https://github.com/paullouisageneau/libdatachannel
- Version: 0.18.0 (084445012d6c63c9f2cc250d88df553aed2eb189, 2022)
- License: MPL 2.0
Module location:
- thirdparty/libdatachannel
# libjuice
- Upstream: https://github.com/paullouisageneau/libjuice
- Version: 1.1.0 (0dabc046cd23da6908749e4c6add834ec29a7c49, 2022)
- License: MPL 2.0
Module location:
- thirdparty/libdatachannel/deps/libjuice
## libsrtp
- Upstream: https://github.com/cisco/libsrtp
- Version: 2.4.2 (90d05bf8980d16e4ac3f16c19b77e296c4bc207b, 2021)
- License: BSD-3-Clause
Module location:
- thirdparty/libdatachannel/deps/libsrtp
## openssl
- Upstream: git://git.openssl.org/openssl.git
- Version: 3.0.7 (19cc035b6c6f2283573d29c7ea7f7d675cf750ce, 2022)
- License: Apache 2.0
Module location:
- thirdparty/openssl
## plog
- Upstream: https://github.com/SergiusTheBest/plog
- Version: git (d8461e9d473e59fbcc1f79eee021550dcf81e618, 2021)
- License: MPL 2.0
Module location:
- thirdparty/libdatachannel/deps/plog
## usrsctp
- Upstream: https://github.com/sctplab/usrsctp
- Version: git (7c31bd35c79ba67084ce029511193a19ceb97447, 2021)
- License: BSD-3-Clause
Module location:
- thirdparty/libdatachannel/deps/usrsctp

1
thirdparty/libdatachannel vendored Submodule

1
thirdparty/openssl vendored Submodule

Submodule thirdparty/openssl added at 19cc035b6c