Skip to content

Commit

Permalink
Add native bridge, starting from RTCDataConnection
Browse files Browse the repository at this point in the history
We want to avoid blocking cross-thread calls that node-gtk provides. So
we create a sort-of thin wrapper library that marshalls the events
natively from WebRTC event thread to main thread.
  • Loading branch information
peat-psuwit committed Sep 9, 2023
1 parent 3967cb3 commit d0f54ec
Show file tree
Hide file tree
Showing 14 changed files with 2,820 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/node_modules/
/lib/
/lib-native/
/src-native/compile_commands.json
/src-native/.cache/
13 changes: 9 additions & 4 deletions .ts-for-girrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const uniq = require('lodash/uniq');

const GstBuildDir = process.env['GST_BUILD_DIR'];

let girDirs = ['/usr/share/gir-1.0'];
let girDirs = ['/usr/share/gir-1.0', `${__dirname}/lib-native`];

if (GstBuildDir) {
// Various Girs are spread accross build directories. Use `find` to
Expand All @@ -15,16 +15,21 @@ if (GstBuildDir) {
{ encoding: 'utf8' }).stdout.split('\n');

// Specify the discovered directories first.
girDirs = [...uniq(dirs), '/usr/share/gir-1.0']
girDirs = [...uniq(dirs), ...girDirs];
}

module.exports = {
pretty: false,
print: false,
verbose: true,
environments: ['node'],
outdir: '@types',
modules: ['Gst-1.0', 'GstWebRTC-1.0'],
outdir: 'src/@types',
modules: [
'Gst-1.0',
'GstWebRTC-1.0',
'GIRepository-2.0',
'NgwNative-0.0',
],
buildType: 'lib',
ignore: [],
girDirectories: girDirs,
Expand Down
15 changes: 15 additions & 0 deletions src-native/NgwNativeCommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_NGWNATIVE
#define NGWNATIVE_PUBLIC __declspec(dllexport)
#else
#define NGWNATIVE_PUBLIC __declspec(dllimport)
#endif
#else
#ifdef BUILDING_NGWNATIVE
#define NGWNATIVE_PUBLIC __attribute__ ((visibility ("default")))
#else
#define NGWNATIVE_PUBLIC
#endif
#endif
Loading

0 comments on commit d0f54ec

Please sign in to comment.