Skip to content

Commit

Permalink
flatbuffers (versatica#1064)
Browse files Browse the repository at this point in the history
Flatbuffers

WIP to remove JSON in favour of flatbuffers for as the worker communication format.

- JSON parsing is CPU intensive.
- JSON is not type safe.
- flatbuffers does not parse the buffer. Reading the message takes 0ms.
- flatbuffers is type safe since code (C++, Typescript, Rust, etc) is autogenerated out of the schema definitions.

Extras that come along with this changes:
- There is now a single Channel for worker communication.
- Previously there were 2 (Channel and PayloadChannel)
- Each message sent Node->Worker requires a single write() call to Channel.
- Previously 2 calls per message were needed for Channel and 4 for PayloadChannel.
- Each message sent Worker->Node previously executed two extra calls to memcpy that are not executed now.

---------

Co-authored-by: Iñaki Baz Castillo <ibc@aliax.net>
Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
  • Loading branch information
3 people authored Nov 8, 2023
1 parent 0b4d4ef commit a7d46d8
Show file tree
Hide file tree
Showing 293 changed files with 24,096 additions and 11,024 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/mediasoup-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
strategy:
matrix:
ci:
- os: ubuntu-20.04
node: 16
- os: ubuntu-20.04
node: 18
- os: ubuntu-22.04
Expand Down Expand Up @@ -45,6 +47,8 @@ jobs:
restore-keys: |
${{ matrix.ci.os }}-node-
- run: npm ci
# NOTE: Add --force since otherwise `npm ci` fails in Node 26 because
# @octokit/auth-token dev dependency requires Node >= 16.
- run: npm ci --force
- run: npm run lint:node
- run: npm run test:node
14 changes: 4 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
## Node.
/node_modules
/node/lib
# flatc generated files.
/node/src/fbs

## Rust.
/Cargo.lock
/rust/examples-frontend/*/node_modules
/rust/examples-frontend/*/package-lock.json
/target

## Worker.
/worker/scripts/node_modules
# Flatc generated files.
/worker/include/FBS
/worker/prebuild
# Vistual Studio generated Stuff.
/worker/**/Debug
Expand All @@ -30,14 +33,5 @@
## Others.
/coverage
/.cache
/NO_GIT
*.swp
*.swo
.DS_Store
# Vistual Studio Code stuff.
/.vscode
# JetBrains IDE stuff.
/.idea

# Packaged module.
*.tgz
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog


### Next

* Switch from JSON based messages to `flatbuffers` ([PR #1064](https://github.com/versatica/mediasoup/pull/1064)).
* Add `ListenInfo` in all transports and send/recv buffer size options ([PR #1084](https://github.com/versatica/mediasoup/pull/1084)).
* Add optional `rtcpListenInfo` in `PlainTransportOptions` ([PR #1099](https://github.com/versatica/mediasoup/pull/1099)).
* Add pause/resume API in `DataProducer` and `DataConsumer` ([PR #1104](https://github.com/versatica/mediasoup/pull/1104)).
* DataChannel subchannels feature ([PR #1152](https://github.com/versatica/mediasoup/pull/1152)).
* `Worker`: Make DTLS fragment stay within MTU size range ([PR #1156](https://github.com/versatica/mediasoup/pull/1156), based on [PR #1143](https://github.com/versatica/mediasoup/pull/1143) by @vpnts-se).


### 3.12.16

* Fix `IceServer` crash when client uses ICE renomination ([PR #1182](https://github.com/versatica/mediasoup/pull/1182)).
Expand Down
Loading

0 comments on commit a7d46d8

Please sign in to comment.