Skip to content

Commit

Permalink
Merge tag '3.12.8' into feat/mediasoup/Audio-consumer-changeProducer-…
Browse files Browse the repository at this point in the history
…implementation-v2-3128

3.12.8
  • Loading branch information
prlanzarin committed Aug 1, 2023
2 parents 6e35df1 + dc4f8f3 commit b08d8fe
Show file tree
Hide file tree
Showing 56 changed files with 3,300 additions and 1,806 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/mediasoup-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ jobs:
ci:
strategy:
matrix:
# Different Node versions on Ubuntu, the latest Node on other platforms.
ci:
- os: ubuntu-22.04
node: 16
- os: ubuntu-22.04
- os: ubuntu-20.04
node: 18
- os: ubuntu-22.04
node: 20
- os: macos-12
node: 18
- os: windows-2022
node: 18

runs-on: ${{ matrix.ci.os }}

env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/mediasoup-worker-prebuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: mediasoup-worker-prebuild

on:
push:
# Only trigger for production releases.
tags:
- "*.*.*"

# Only trigger when other workflows succeeded.
workflow_run:
workflows: [mediasoup-worker, mediasoup-node, mediasoup-rust]
types:
- completed

jobs:
ci:
strategy:
fail-fast: false
matrix:
build:
# For Linux let's use an old version of Ubuntu (20.04) that builds the
# mediasoup-worker binary using an old version of GLib, so it will work
# on Linux hosts running more modern GLib versions.
# See https://github.com/versatica/mediasoup/issues/1089.
- os: ubuntu-20.04
cc: gcc
cxx: g++
- os: macos-12
cc: clang
cxx: clang++
- os: windows-2022
cc: cl
cxx: cl
node:
- 18

runs-on: ${{ matrix.build.os }}

env:
CC: ${{ matrix.build.cc }}
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

# We need to install some NPM production deps for npm-scripts.mjs to work.
- run: npm ci --ignore-scripts --omit=dev
- run: npm run worker:build
# Publish prebuild binaries on tag.
- run: npm run worker:prebuild
- name: Upload mediasoup-worker prebuilt binary
uses: softprops/action-gh-release@v1
with:
files: worker/prebuild/mediasoup-worker-*.tgz
3 changes: 3 additions & 0 deletions .github/workflows/mediasoup-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
env:
CC: ${{ matrix.build.cc }}
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
Expand All @@ -54,6 +55,8 @@ jobs:
with:
node-version: ${{ matrix.node }}

# We need to install some NPM production deps for npm-scripts.mjs to work.
- run: npm ci --ignore-scripts --omit=dev
- run: npm run install-clang-tools
# TODO: Maybe fix this one day.
if: runner.os != 'Windows'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Meson.
/worker/out
/worker/subprojects/*
!/worker/subprojects/*.wrap
!/worker/subprojects/.clang-tidy
Expand All @@ -14,8 +15,8 @@
/target

## Worker.
/worker/out
/worker/scripts/node_modules
/worker/prebuild
# Vistual Studio generated Stuff.
/worker/**/Debug
/worker/**/Release
Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# Changelog

### 3.12.8

* Export `workerBin` absolute path ([PR #1123](https://github.com/versatica/mediasoup/pull/1123)).


### 3.12.7

* `SimulcastConsumer`: Fix lack of "layerschange" event when all streams in the producer die ([PR #1122](https://github.com/versatica/mediasoup/pull/1122)).


### 3.12.6

* `Worker`: Add `Transport::Destroying()` protected method ([PR #1114](https://github.com/versatica/mediasoup/pull/1114)).
* `RtpStreamRecv`: Fix jitter calculation ([PR #1117](https://github.com/versatica/mediasoup/pull/1117), thanks to @penguinol).
* Revert "Node: make types.ts only export types rather than the entire class/code" ([PR #1109](https://github.com/versatica/mediasoup/pull/1109)) because it requires `typescript` >= 5 in the apps that import mediasoup and we don't want to be that strict yet.


### 3.12.5

* `DataConsumer`: Fix removed 'bufferedamountlow' notification ([PR #1113](https://github.com/versatica/mediasoup/pull/1113)).


### 3.12.4

* Fix downloaded prebuilt binary check on Windows ([PR #1105](https://github.com/versatica/mediasoup/pull/1105) by @woodfe).


### 3.12.3

Migrate `npm-scripts.js` to `npm-scripts.mjs` (ES Module) ([PR #1093](https://github.com/versatica/mediasoup/pull/1093)).


### 3.12.2

* CI: Use `ubuntu-20.04` to build mediasoup-worker prebuilt on Linux ([PR #1092](https://github.com/versatica/mediasoup/pull/1092)).


### 3.12.1

* mediasoup-worker prebuild: Fallback to local building if fetched binary doesn't run on current host ([PR #1090](https://github.com/versatica/mediasoup/pull/1090)).


### 3.12.0

* Automate and publish prebuilt `mediasoup-worker` binaries ([PR #1087](https://github.com/versatica/mediasoup/pull/1087), thanks to @barlock for his work in ([PR #1083](https://github.com/versatica/mediasoup/pull/1083)).


### 3.11.26

* `Worker`: Fix NACK timer and avoid negative RTT ([PR #1082](https://github.com/versatica/mediasoup/pull/1082), thanks to @o-u-p for his work in ([PR #1076](https://github.com/versatica/mediasoup/pull/1076)).


### 3.11.25

* `Worker`: Require C++17, Meson >= 1.1.0 and update subprojects ([PR #1081](https://github.com/versatica/mediasoup/pull/1081)).


### 3.11.24

Expand Down
17 changes: 13 additions & 4 deletions doc/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Compiles mediasoup TypeScript code (`lib` folder) JavaScript, places it into the

Builds the `mediasoup-worker` binary. It invokes `make`below.

### `npm run worker:prebuild`

Creates a prebuilt of `mediasoup-worker` in the `worker/prebuild` folder.

### `npm run lint`

Runs both `npm run lint:node` and `npm run lint:worker`.
Expand Down Expand Up @@ -60,7 +64,7 @@ Installs clang tools needed for local development.

## Rust

The only special feature in Rust case is special environment variable `KEEP_BUILD_ARTIFACTS`, that when set to `1` will allow incremental recompilation of changed C++ sources during hacking on mediasoup.
The only special feature in Rust case is special environment variable `"KEEP_BUILD_ARTIFACTS", that when set to `1` will allow incremental recompilation of changed C++ sources during hacking on mediasoup.
It is not necessary for normal usage of mediasoup as a dependency.

## Makefile
Expand Down Expand Up @@ -122,7 +126,7 @@ In order to instruct the mediasoup Node.js module to use the `Debug` mediasoup-w
MEDIASOUP_BUILDTYPE=Debug node myapp.js
```

If the "MEDIASOUP_WORKER_BIN" environment variable is set, mediasoup will use the it as mediasoup-worker binary and **won't** compile the binary:
If the "MEDIASOUP_WORKER_BIN" environment variable is set (it must be an absolute file path), mediasoup will use the it as mediasoup-worker binary and **won't** compile the binary:

```bash
MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js
Expand All @@ -132,7 +136,7 @@ MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js

Builds the `libmediasoup-worker` static library at `worker/out/Release/`.

`MEDIASOUP_MAX_CORES` and `MEDIASOUP_BUILDTYPE` environment variables from above still apply for static library build.
"MEDIASOUP_MAX_CORES"` and "MEDIASOUP_BUILDTYPE" environment variables from above still apply for static library build.

### `make xcode`

Expand All @@ -150,6 +154,11 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/

Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder.


### 'make test-asan'

Run test with Address Sanitizer.

### `make tidy`

Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules.
Expand All @@ -160,7 +169,7 @@ Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code
* [PyYAML](https://pyyaml.org/) is required.
- In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`.

`MEDIASOUP_TIDY_CHECKS` environment variable with a comma separated list of checks overrides the checks defined in `.clang-tidy` file.
"MEDIASOUP_TIDY_CHECKS" environment variable with a comma separated list of checks overrides the checks defined in `.clang-tidy` file.

### `make fuzzer`

Expand Down
13 changes: 9 additions & 4 deletions node/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const eslintConfig =
settings : {},
parserOptions :
{
ecmaVersion : 2018,
ecmaVersion : 2022,
sourceType : 'module',
ecmaFeatures :
{
impliedStrict : true
},
lib : [ 'es2018' ],
lib : [ 'es2022' ],
project : 'node/tsconfig.json'
},
globals :
Expand Down Expand Up @@ -78,7 +78,7 @@ const eslintConfig =
'max-len' : [ 2, 100,
{
tabWidth : 2,
comments : 84,
comments : 88,
ignoreUrls : true,
ignoreStrings : true,
ignoreTemplateLiterals : true,
Expand Down Expand Up @@ -166,7 +166,12 @@ const eslintConfig =
'prefer-rest-params' : 2,
'prefer-spread' : 2,
'prefer-template' : 2,
'quotes' : [ 2, 'single', { avoidEscape: true } ],
'quotes' : [ 2, 'single',
{
avoidEscape : true,
allowTemplateLiterals : true
}
],
'semi' : [ 2, 'always' ],
'semi-spacing' : 2,
'space-before-blocks' : 2,
Expand Down
2 changes: 1 addition & 1 deletion node/src/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export type WorkerObserverEvents =
// If env MEDIASOUP_WORKER_BIN is given, use it as worker binary.
// Otherwise if env MEDIASOUP_BUILDTYPE is 'Debug' use the Debug binary.
// Otherwise use the Release binary.
const workerBin = process.env.MEDIASOUP_WORKER_BIN
export const workerBin = process.env.MEDIASOUP_WORKER_BIN
? process.env.MEDIASOUP_WORKER_BIN
: process.env.MEDIASOUP_BUILDTYPE === 'Debug'
? path.join(__dirname, '..', '..', 'worker', 'out', 'Debug', 'mediasoup-worker')
Expand Down
7 changes: 6 additions & 1 deletion node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { Worker, WorkerSettings } from './Worker';
import { workerBin, Worker, WorkerSettings } from './Worker';
import * as utils from './utils';
import { supportedRtpCapabilities } from './supportedRtpCapabilities';
import { RtpCapabilities } from './RtpParameters';
Expand Down Expand Up @@ -36,6 +36,11 @@ const observer = new EnhancedEventEmitter<ObserverEvents>();
*/
export { observer };

/**
* Full path of the mediasoup-worker binary.
*/
export { workerBin };

/**
* Create a Worker.
*/
Expand Down
1 change: 1 addition & 0 deletions node/src/tests/test-AudioLevelObserver.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as mediasoup from '../';

const { createWorker } = mediasoup;

let worker: mediasoup.types.Worker;
Expand Down
11 changes: 11 additions & 0 deletions node/src/tests/test-Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ let worker: mediasoup.types.Worker;
beforeEach(() => worker && !worker.closed && worker.close());
afterEach(() => worker && !worker.closed && worker.close());

test('Worker.workerBin matches mediasoup-worker absolute path', async () =>
{
const workerBin = process.env.MEDIASOUP_WORKER_BIN
? process.env.MEDIASOUP_WORKER_BIN
: process.env.MEDIASOUP_BUILDTYPE === 'Debug'
? path.join(__dirname, '..', '..', '..', 'worker', 'out', 'Debug', 'mediasoup-worker')
: path.join(__dirname, '..', '..', '..', 'worker', 'out', 'Release', 'mediasoup-worker');

expect(mediasoup.workerBin).toBe(workerBin);
});

test('createWorker() succeeds', async () =>
{
const onObserverNewWorker = jest.fn();
Expand Down
4 changes: 2 additions & 2 deletions node/src/tests/test-mediasoup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('mediasoup.getSupportedRtpCapabilities() returns the mediasoup RTP capabili
const rtpCapabilities2 = getSupportedRtpCapabilities();

expect(rtpCapabilities2).not.toEqual(rtpCapabilities);
}, 500);
});

test('parseScalabilityMode() works', () =>
{
Expand Down Expand Up @@ -52,4 +52,4 @@ test('parseScalabilityMode() works', () =>

expect(parseScalabilityMode('L4T7_KEY_SHIFT'))
.toEqual({ spatialLayers: 4, temporalLayers: 7, ksvc: true });
}, 500);
});
2 changes: 1 addition & 1 deletion node/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export * from './RtpParameters';
export * from './SctpParameters';
export * from './SrtpParameters';
export * from './errors';
export { ScalabilityMode } from './scalabilityModes';
export type { ScalabilityMode } from './scalabilityModes';

export type AppData =
{
Expand Down
8 changes: 7 additions & 1 deletion node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@
"declaration": true,
"declarationMap": true
},
"include": [ "src" ]
"include": [ "src" ],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority",
"synchronousWatchDirectory": true
}
}
Loading

0 comments on commit b08d8fe

Please sign in to comment.