Compare commits

...

38 commits

Author SHA1 Message Date
wrapper
4a7cb0dc2a 21521 2025-07-17 13:34:10 +07:00
wrapper
8e036283a9 part 2 2025-07-17 13:32:15 +07:00
wrapper
36111eec76 socket opts 2025-07-17 13:26:56 +07:00
wrapper
76c5dbc421 Allow multiplex
Some checks failed
Node CI / build-linux (18.x) (push) Has been cancelled
Node CI / build-linux (20.x) (push) Has been cancelled
Node CI / build-linux (22.x) (push) Has been cancelled
2025-07-17 11:28:41 +07:00
neoxpert
62b4a8ceac
Update SRT to 1.5.4 (#74)
* use SRT 1.5.4

* Update nodejs.yml

drop EoL NodeJS versions
2025-04-08 22:24:10 +02:00
Jonas Birmé
fe1d9f9cee
0.8.3 2023-11-20 13:02:52 +01:00
yaruno
f7938b4567
fix: AsyncSRT types and tests, add super() to AsyncSRT constructor (#67)
* add event emitter to async class

* fix types for AsyncSRT class

* Should call super() on constructor as extending event emitter, fixes tests
2023-11-20 12:54:11 +01:00
Jonas Birmé
cf06fe6ed1
0.8.2 2023-11-20 10:48:54 +01:00
yaruno
bec9609f70
fix: add event emitter to async class (#64) 2023-11-20 10:37:53 +01:00
Jonas Birmé
04ce7d238b 0.8.1 2023-09-19 23:05:46 +02:00
neoxpert
b40d4a3c8c Update srt-enums.h
Updated enum definition to take new values into account aswell as reserved spaces.
2023-09-18 21:16:25 +02:00
Jonas Birmé
23407cea60 0.8.0 2023-09-18 14:18:38 +02:00
Jonas Birmé
23efbb8501 feat: bump to libsrt 1.5.2 2023-09-04 09:01:34 +02:00
Jonas Birmé
ed0e4913a6 0.7.1 2023-08-10 15:53:12 +02:00
Max van den Bosch
c3e77b11dd
Fixed Windows build: using"diff" instead of patch (#57) 2023-08-10 15:38:46 +02:00
Jonas Birmé
03fd1f7f37 chore: test build on node v18 2023-08-10 15:36:03 +02:00
Max van den Bosch
9e9a6bddce
Fix for build directories that contain spaces (#59) 2023-08-09 20:15:56 +02:00
dependabot[bot]
79fb0548c5
Bump json5 from 2.1.3 to 2.2.3 (#50)
Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 09:38:19 +01:00
dependabot[bot]
05d3cf5dd1
Bump lodash from 4.17.19 to 4.17.21 (#48)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-07 12:56:30 +01:00
dependabot[bot]
3a90057bc5
Bump decode-uri-component from 0.2.0 to 0.2.2 (#47)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-07 12:53:30 +01:00
Jonas Birmé
be273dd94e 0.7.0 2022-11-11 13:58:23 +01:00
dependabot[bot]
69b41ac787
Bump minimist from 1.2.5 to 1.2.7 (#44)
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 13:56:18 +01:00
dependabot[bot]
3928186d2a
Bump minimatch from 3.0.4 to 3.1.2 (#45)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 13:56:04 +01:00
dependabot[bot]
3dbe737fdc
Bump ansi-regex from 4.1.0 to 4.1.1 (#46)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 13:55:51 +01:00
Jonas Birmé
3ecb83ba6b
feat: update to SRT lib version 1.4.4 (#43)
Including:
- Updated SRT lib version to 1.4.4
- Building on Darwin arm64
- Obtain OPENSSL root using brew --prefix openssl
- Updated to latest node-addon-api and node-gyp
2022-11-10 16:50:48 +01:00
dependabot[bot]
d9fd701dd9
Bump json-schema and jsprim (#42)
Bumps [json-schema](https://github.com/kriszyp/json-schema) and [jsprim](https://github.com/joyent/node-jsprim). These dependencies needed to be updated together.

Updates `json-schema` from 0.2.3 to 0.4.0
- [Release notes](https://github.com/kriszyp/json-schema/releases)
- [Commits](https://github.com/kriszyp/json-schema/compare/v0.2.3...v0.4.0)

Updates `jsprim` from 1.4.1 to 1.4.2
- [Release notes](https://github.com/joyent/node-jsprim/releases)
- [Changelog](https://github.com/TritonDataCenter/node-jsprim/blob/v1.4.2/CHANGES.md)
- [Commits](https://github.com/joyent/node-jsprim/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: json-schema
  dependency-type: indirect
- dependency-name: jsprim
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:43:47 +02:00
dependabot[bot]
c98529f3ae
Bump node-notifier from 8.0.0 to 8.0.1 (#18)
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:43:36 +02:00
dependabot[bot]
64c0d06541
Bump y18n from 4.0.0 to 4.0.1 (#22)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:43:23 +02:00
dependabot[bot]
e8dfa3ac44
Bump lodash from 4.17.19 to 4.17.21 (#23)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:43:11 +02:00
dependabot[bot]
a18d038172
Bump hosted-git-info from 2.8.8 to 2.8.9 (#24)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:42:57 +02:00
dependabot[bot]
2dc4dc28f0
Bump glob-parent from 5.1.1 to 5.1.2 (#26)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:42:40 +02:00
dependabot[bot]
c4e80fe6d7
Bump path-parse from 1.0.6 to 1.0.7 (#29)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:42:25 +02:00
dependabot[bot]
f63ee34132
Bump tar from 6.0.2 to 6.1.11 (#31)
Bumps [tar](https://github.com/npm/node-tar) from 6.0.2 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.0.2...v6.1.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:42:10 +02:00
dependabot[bot]
155f4405ae
Bump tmpl from 1.0.4 to 1.0.5 (#32)
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:41:56 +02:00
dependabot[bot]
050635e78c
Bump ajv from 6.12.2 to 6.12.6 (#35)
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.2 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.2...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:41:42 +02:00
dependabot[bot]
a71c2f37b3
Bump minimist from 1.2.5 to 1.2.6 (#36)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:41:27 +02:00
dependabot[bot]
12d3894096
Bump jsdom from 16.4.0 to 16.7.0 (#40)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.4.0 to 16.7.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/16.4.0...16.7.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 23:41:07 +02:00
Jonas Birmé
ed280c120c chore(docs): added support section 2022-09-26 16:02:15 +02:00
12 changed files with 1543 additions and 1684 deletions

View file

@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test

View file

@ -176,6 +176,16 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Support
Join our [community on Slack](http://slack.streamingtech.se) where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:
- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement
Contact [sales@eyevinn.se](mailto:sales@eyevinn.se) if you are interested.
## About Eyevinn Technology
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor.

2997
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "@eyevinn/srt",
"version": "0.6.0",
"version": "0.8.3",
"description": "Nodejs bindings for Secure Reliable Transport SDK",
"main": "index.js",
"scripts": {
@ -43,9 +43,10 @@
"dependencies": {
"debug": "^4.1.1",
"del": "^5.1.0",
"diff": "^5.1.0",
"git-clone": "^0.1.0",
"node-addon-api": "^3.0.0",
"node-gyp": "^7.0.0"
"node-addon-api": "^5.0.0",
"node-gyp": "^9.3.0"
},
"bugs": {
"url": "https://github.com/Eyevinn/node-srt/issues"

View file

@ -4,15 +4,16 @@
const path = require('path');
const fs = require('fs');
const jsdiff = require('diff');
const process = require('process');
const clone = require('git-clone');
const del = require('del');
const { spawnSync } = require('child_process');
const { spawnSync, execSync } = require('child_process');
const os = require('os');
const env = process.env;
const SRT_REPO = env.NODE_SRT_REPO || "https://github.com/Haivision/srt.git";
const SRT_CHECKOUT = "v1.4.2";
const SRT_CHECKOUT = "v1.5.4";
const srtRepoPath = env.NODE_SRT_LOCAL_REPO ? `file://${path.join(__dirname, env.NODE_SRT_LOCAL_REPO)}` : SRT_REPO;
const srtCheckout = env.NODE_SRT_CHECKOUT || SRT_CHECKOUT;
@ -23,7 +24,7 @@ const buildDir = path.join(depsPath, 'build'); // FIXME: name this srt-build (in
const numCpus = os.cpus().length; // NOTE: not the actual physical cores amount btw, see https://www.npmjs.com/package/physical-cpu-count
if (!fs.existsSync(depsPath)) {
console.log('Creating dir:', depsPath)
console.log('Creating dir:', depsPath);
fs.mkdirSync(depsPath);
}
@ -36,6 +37,21 @@ if (!fs.existsSync(srtSourcePath)) {
if (fs.existsSync(srtSourcePath)) del.sync(srtSourcePath);
process.exit(1);
}
console.log("Patch build script");
// Read the source file and the patch file
const sourceFilePath = path.join(srtSourcePath, 'configure-data.tcl');
const patchFilePath = path.join(__dirname, 'configure-data.tcl.patch');
// Read the source file and the patch file
const sourceContent = fs.readFileSync(sourceFilePath, 'utf8');
const patchContent = fs.readFileSync(patchFilePath, 'utf8');
// Apply the patch
const patchedContent = jsdiff.applyPatch(sourceContent, patchContent);
// Write the patched content back to the source file
fs.writeFileSync(sourceFilePath, patchedContent, 'utf8');
build();
});
@ -45,10 +61,16 @@ if (!fs.existsSync(srtSourcePath)) {
function build() {
console.log('Building SRT SDK and prerequisites for current platform:', process.platform);
let opensslRoot;
switch (process.platform) {
case "win32":
buildWin32();
break;
case "darwin":
opensslRoot = execSync('brew --prefix openssl').toString().trim();
process.env.OPENSSL_ROOT_DIR = opensslRoot;
buildNx();
break;
default:
buildNx();
}
@ -86,7 +108,7 @@ function buildWin32() {
}
console.log("Running cmake generator");
const generator = spawnSync('cmake', [ srtSourcePath, '-DCMAKE_BUILD_TYPE=Release', '-G"Visual Studio 16 2019"', '-A', process.arch, '-DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\\scripts\\buildsystems\\vcpkg.cmake' ], { cwd: buildDir, shell: true } );
const generator = spawnSync('cmake', [ '"'+srtSourcePath+'"', '-DCMAKE_BUILD_TYPE=Release', '-G"Visual Studio 16 2019"', '-A', process.arch, '-DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\\scripts\\buildsystems\\vcpkg.cmake' ], { cwd: buildDir, shell: true } );
if (generator.stdout)
console.log(generator.stdout.toString());
if (generator.status) {
@ -95,7 +117,7 @@ function buildWin32() {
}
console.log("Running CMake build");
const build = spawnSync('cmake', [ '--build', buildDir, '--config', 'Release' ], { cwd: buildDir, shell: true } );
const build = spawnSync('cmake', [ '--build', '"'+buildDir+'"', '--config', 'Release' ], { cwd: buildDir, shell: true } );
if (build.stdout)
console.log(build.stdout.toString());
if (build.status) {

View file

@ -0,0 +1,17 @@
diff --git a/configure-data.tcl b/configure-data.tcl
index 5c0ee2e..ebca78e 100644
--- a/configure-data.tcl
+++ b/configure-data.tcl
@@ -372,9 +372,10 @@ proc postprocess {} {
if { $er } {
error "You must have OpenSSL installed from 'brew' tool. The standard Mac version is inappropriate."
}
+ set prefix [exec brew --prefix openssl]
- lappend ::cmakeopt "-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include"
- lappend ::cmakeopt "-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib/libcrypto.a"
+ lappend ::cmakeopt "-DOPENSSL_INCLUDE_DIR=$prefix/include"
+ lappend ::cmakeopt "-DOPENSSL_LIBRARIES=$prefix/lib/libcrypto.a"
}
}
}

View file

@ -6,6 +6,7 @@ const debug = require('debug')('srt-async');
const { traceCallToString, extractTransferListFromParams } = require('./async-helpers');
const { SRT } = require('../build/Release/node_srt.node');
const EventEmitter = require('events');
const DEFAULT_PROMISE_TIMEOUT_MS = 3000;
@ -15,7 +16,7 @@ const DEBUG = false;
const WORK_ID_GEN_MOD = 0xFFF;
*/
class AsyncSRT {
class AsyncSRT extends EventEmitter {
/**
* @static
@ -24,7 +25,7 @@ class AsyncSRT {
static TimeoutMs = DEFAULT_PROMISE_TIMEOUT_MS;
constructor() {
super()
DEBUG && debug('Creating task-runner worker instance');
this._worker = new Worker(path.resolve(__dirname, './async-worker.js'));
@ -67,6 +68,7 @@ class AsyncSRT {
'\n Binding call:', traceCallToString(data.call.method, data.call.args),
//'\n Stacktrace:', data.err.stack
);
this.emit('error', data.err.message)
return;
}

View file

@ -177,7 +177,7 @@ Napi::Value NodeSRT::Accept(const Napi::CallbackInfo& info) {
Napi::Error::New(env, srt_getlasterror_str()).ThrowAsJavaScriptException();
return Napi::Number::New(env, SRT_ERROR);
}
srt_close(socketValue);
socketValue = Napi::Number::New(env, SRT_INVALID_SOCK);
return Napi::Number::New(env, their_fd);
}

View file

@ -1,66 +1,73 @@
#define ENUM(E) StaticValue(#E, Napi::Number::New(env, E))
// egrep '^\s+SRTO' srtcore/srt.h | sed 's/^.*\(SRTO_[^, ]*\)[, ].*$/ ENUM\(\1\), \\/'
#define ENUM(E,F) StaticValue(#E,Napi::Number::New(env,F))
#define SOCKET_OPTIONS \
ENUM(SRTO_MSS), \
ENUM(SRTO_SNDSYN), \
ENUM(SRTO_RCVSYN), \
ENUM(SRTO_ISN), \
ENUM(SRTO_FC), \
ENUM(SRTO_SNDBUF), \
ENUM(SRTO_RCVBUF), \
ENUM(SRTO_LINGER), \
ENUM(SRTO_UDP_SNDBUF), \
ENUM(SRTO_UDP_RCVBUF), \
ENUM(SRTO_RENDEZVOUS), \
ENUM(SRTO_SNDTIMEO), \
ENUM(SRTO_RCVTIMEO), \
ENUM(SRTO_REUSEADDR), \
ENUM(SRTO_MAXBW), \
ENUM(SRTO_STATE), \
ENUM(SRTO_EVENT), \
ENUM(SRTO_SNDDATA), \
ENUM(SRTO_RCVDATA), \
ENUM(SRTO_SENDER), \
ENUM(SRTO_TSBPDMODE), \
ENUM(SRTO_INPUTBW), \
ENUM(SRTO_OHEADBW), \
ENUM(SRTO_PASSPHRASE), \
ENUM(SRTO_PBKEYLEN), \
ENUM(SRTO_KMSTATE), \
ENUM(SRTO_IPTTL), \
ENUM(SRTO_IPTOS), \
ENUM(SRTO_TLPKTDROP), \
ENUM(SRTO_SNDDROPDELAY), \
ENUM(SRTO_NAKREPORT), \
ENUM(SRTO_VERSION), \
ENUM(SRTO_PEERVERSION), \
ENUM(SRTO_CONNTIMEO), \
ENUM(SRTO_SNDKMSTATE), \
ENUM(SRTO_RCVKMSTATE), \
ENUM(SRTO_LOSSMAXTTL), \
ENUM(SRTO_RCVLATENCY), \
ENUM(SRTO_PEERLATENCY), \
ENUM(SRTO_MINVERSION), \
ENUM(SRTO_STREAMID), \
ENUM(SRTO_CONGESTION), \
ENUM(SRTO_MESSAGEAPI), \
ENUM(SRTO_PAYLOADSIZE), \
ENUM(SRTO_TRANSTYPE), \
ENUM(SRTO_KMREFRESHRATE), \
ENUM(SRTO_KMPREANNOUNCE), \
ENUM(SRTO_ENFORCEDENCRYPTION), \
ENUM(SRTO_IPV6ONLY), \
ENUM(SRTO_PEERIDLETIMEO), \
ENUM(SRTO_PACKETFILTER)
ENUM(SRTO_MSS, 0), \
ENUM(SRTO_SNDSYN, 1), \
ENUM(SRTO_RCVSYN, 2), \
ENUM(SRTO_ISN, 3), \
ENUM(SRTO_FC, 4), \
ENUM(SRTO_SNDBUF, 5), \
ENUM(SRTO_RCVBUF, 6), \
ENUM(SRTO_LINGER, 7), \
ENUM(SRTO_UDP_SNDBUF, 8), \
ENUM(SRTO_UDP_RCVBUF, 9), \
ENUM(SRTO_RENDEZVOUS, 12), \
ENUM(SRTO_SNDTIMEO, 13), \
ENUM(SRTO_RCVTIMEO, 14), \
ENUM(SRTO_REUSEADDR, 15), \
ENUM(SRTO_MAXBW, 16), \
ENUM(SRTO_STATE, 17), \
ENUM(SRTO_EVENT, 18), \
ENUM(SRTO_SNDDATA, 19), \
ENUM(SRTO_RCVDATA, 20), \
ENUM(SRTO_SENDER, 21), \
ENUM(SRTO_TSBPDMODE, 22), \
ENUM(SRTO_LATENCY, 23), \
ENUM(SRTO_INPUTBW, 24), \
ENUM(SRTO_OHEADBW, 25), \
ENUM(SRTO_PASSPHRASE, 26), \
ENUM(SRTO_PBKEYLEN, 27), \
ENUM(SRTO_KMSTATE, 28), \
ENUM(SRTO_IPTTL, 29), \
ENUM(SRTO_IPTOS, 30), \
ENUM(SRTO_TLPKTDROP, 31), \
ENUM(SRTO_SNDDROPDELAY, 32), \
ENUM(SRTO_NAKREPORT, 33), \
ENUM(SRTO_VERSION, 34), \
ENUM(SRTO_PEERVERSION, 35), \
ENUM(SRTO_CONNTIMEO, 36), \
ENUM(SRTO_DRIFTTRACER, 37), \
ENUM(SRTO_MININPUTBW, 38), \
ENUM(SRTO_SNDKMSTATE, 40), \
ENUM(SRTO_RCVKMSTATE, 41), \
ENUM(SRTO_LOSSMAXTTL, 42), \
ENUM(SRTO_RCVLATENCY, 43), \
ENUM(SRTO_PEERLATENCY, 44), \
ENUM(SRTO_MINVERSION, 45), \
ENUM(SRTO_STREAMID, 46), \
ENUM(SRTO_CONGESTION, 47), \
ENUM(SRTO_MESSAGEAPI, 48), \
ENUM(SRTO_PAYLOADSIZE, 49), \
ENUM(SRTO_TRANSTYPE, 50), \
ENUM(SRTO_KMREFRESHRATE, 51), \
ENUM(SRTO_KMPREANNOUNCE, 52), \
ENUM(SRTO_ENFORCEDENCRYPTION, 53), \
ENUM(SRTO_IPV6ONLY, 54), \
ENUM(SRTO_PEERIDLETIMEO, 55), \
ENUM(SRTO_BINDTODEVICE, 56), \
ENUM(SRTO_GROUPCONNECT, 57), \
ENUM(SRTO_GROUPMINSTABLETIMEO, 58), \
ENUM(SRTO_GROUPTYPE, 59), \
ENUM(SRTO_PACKETFILTER, 60), \
ENUM(SRTO_RETRANSMITALGO, 61)
#define SOCKET_STATUS \
ENUM(SRTS_INIT), \
ENUM(SRTS_OPENED), \
ENUM(SRTS_LISTENING), \
ENUM(SRTS_CONNECTING), \
ENUM(SRTS_CONNECTED), \
ENUM(SRTS_BROKEN), \
ENUM(SRTS_CLOSING), \
ENUM(SRTS_CLOSED)
ENUM(SRTS_INIT, 1), \
ENUM(SRTS_OPENED, 2), \
ENUM(SRTS_LISTENING, 3), \
ENUM(SRTS_CONNECTING, 4), \
ENUM(SRTS_CONNECTED, 5), \
ENUM(SRTS_BROKEN, 6), \
ENUM(SRTS_CLOSING, 7), \
ENUM(SRTS_CLOSED, 8), \
ENUM(SRTS_NONEXIST, 9)

View file

@ -99,7 +99,7 @@ class SRTConnection extends EventEmitter {
this.emit('closing');
const result = await asyncSrt.close(this.fd);
this.emit('closed', result);
this.off();
this.removeAllListeners();
return result;
}
@ -113,6 +113,14 @@ class SRTConnection extends EventEmitter {
this._gotFirstData = true;
}
}
async getSocketOpt(opt) {
return await this._asyncSrt.getSockOpt(this.fd, opt);
}
async setSocketOpt(opt, val) {
return await this._asyncSrt.setSockOpt(this.fd, opt, val);
}
}
/**

View file

@ -1,11 +1,11 @@
import { EventEmitter } from "events";
import { SRTLoggingLevel, SRTResult, SRTSockOpt, SRTSockStatus } from "../src/srt-api-enums";
import { SRTReadReturn, SRTFileDescriptor, SRTEpollEvent, SRTSockOptValue, SRTStats } from "./srt-api"
export type AsyncSRTCallback<T> = (result: T) => void;
export class AsyncSRT {
export class AsyncSRT extends EventEmitter {
static TimeoutMs: number;

View file

@ -30,6 +30,9 @@ export class SRTConnection extends EventEmitter {
onData(): void;
getReaderWriter(): AsyncReaderWriter;
getSocketOpt(opt: number): Promise<number|boolean|string>;
setSocketOpt(opt: number, val: number|boolean|string): Promise<number>;
}
export class SRTServer extends EventEmitter /*<SRTServerEvent>*/ {