Skip to content

Commit

Permalink
Merge branch 'v3' into lozen/optimize-code
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhenyilang committed Apr 29, 2024
2 parents 0406a79 + d3f1402 commit 69480f9
Show file tree
Hide file tree
Showing 113 changed files with 3,413 additions and 2,080 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: 'Release'

steps:
- name: Checkout repository
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/mediasoup-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
strategy:
matrix:
ci:
- os: ubuntu-20.04
node: 16
- os: ubuntu-20.04
node: 18
- os: ubuntu-22.04
Expand All @@ -25,12 +23,16 @@ jobs:
node: 20
- os: windows-2022
node: 20
build-type:
- Release
- Debug

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

env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}

steps:
- name: Checkout
Expand All @@ -50,9 +52,8 @@ jobs:
restore-keys: |
${{ matrix.ci.os }}-node-
# NOTE: Add --force since some dev dependencies require Node >= 18.
- name: npm ci
run: npm ci --force --foreground-scripts
run: npm ci --foreground-scripts

- name: npm run lint:node
run: npm run lint:node
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/mediasoup-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
ci:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- macos-12
- macos-14
- windows-2022
ci:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-12
- os: macos-14
- os: windows-2022

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

env:
KEEP_BUILD_ARTIFACTS: '1'
Expand All @@ -37,16 +37,20 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
key: ${{ matrix.ci.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: cargo fmt
run: cargo fmt --all -- --check

- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings

# NOTE: In Windows this will build and test libmediasoupworker in release
# mode twice since build.rs doesn't allow debug mode for Windows.
- name: cargo test
run: cargo test --verbose
run: |
cargo test --verbose
cargo test --release --verbose
- name: cargo doc
run: cargo doc --locked --all --no-deps --lib
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/mediasoup-worker-fuzzer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
- os: ubuntu-22.04
cc: clang
cxx: clang++
build-type:
- Release
- Debug

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

Expand All @@ -24,6 +27,7 @@ jobs:
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}

steps:
- name: Checkout
Expand All @@ -32,6 +36,12 @@ jobs:
# We need to install pip invoke manually.
- name: pip3 install invoke
run: pip3 install invoke
if: runner.os != 'macOS'

# In macOS we need to specify this option.
- name: pip3 install --break-system-packages invoke
run: pip3 install --break-system-packages invoke
if: runner.os == 'macOS'

# Build the mediasoup-worker-fuzzer binary (which uses libFuzzer).
- name: invoke -r worker fuzzer
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mediasoup-worker-prebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: 'Release'

steps:
- name: Checkout
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/mediasoup-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
# A single Node.js version should be fine for C++.
node:
- 20
build-type:
- Release
- Debug

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

Expand All @@ -45,6 +48,7 @@ jobs:
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: 'true'
MEDIASOUP_LOCAL_DEV: 'true'
MEDIASOUP_BUILDTYPE: ${{ matrix.build-type }}

steps:
- name: Checkout
Expand All @@ -67,6 +71,12 @@ jobs:
# We need to install pip invoke manually.
- name: pip3 install invoke
run: pip3 install invoke
if: runner.os != 'macOS'

# In macOS we need to specify this option.
- name: pip3 install --break-system-packages invoke
run: pip3 install --break-system-packages invoke
if: runner.os == 'macOS'

# We need to install npm deps of worker/scripts/package.json.
- name: npm ci --prefix worker/scripts
Expand Down
40 changes: 28 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

### 3.14.2

- Update worker subprojects ([PR #1376](https://github.com/versatica/mediasoup/pull/1376)).
- OPUS: Fix DTX detection ([PR #1357](https://github.com/versatica/mediasoup/pull/1357)).
- Worker: Fix sending callback leaks ([PR #1383](https://github.com/versatica/mediasoup/pull/1383), credits to @Lynnworld).

### 3.14.1

- Node: Bring transport `rtpPacketLossReceived` and `rtpPacketLossSent` stats back ([PR #1371](https://github.com/versatica/mediasoup/pull/1371)).

### 3.14.0

- `TransportListenInfo`: Add `portRange` (deprecate worker port range) ([PR #1365](https://github.com/versatica/mediasoup/pull/1365)).
- Require Node.js >= 18 ([PR #1365](https://github.com/versatica/mediasoup/pull/1365)).

### 3.13.24

- Node: Fix missing `bitrateByLayer` field in stats of `RtpRecvStream` in Node ([PR #1349](https://github.com/versatica/mediasoup/pull/1349)).
Expand Down Expand Up @@ -50,20 +65,21 @@
### 3.13.14

- Avoid modification of user input data ([PR #1285](https://github.com/versatica/mediasoup/pull/1285)).
- `ListenInfo`: Add transport socket flags ([PR #1291](https://github.com/versatica/mediasoup/pull/1291)).
- `ListenInfo`: Ignore given socket flags if not suitable for given IP family or transport ([PR #1294](https://github.com/versatica/mediasoup/pull/1294)).
- `TransportListenInfo`: Add transport socket flags ([PR #1291](https://github.com/versatica/mediasoup/pull/1291)).
- Note that `flags.ipv6Only` is `false` by default.
- `TransportListenInfo`: Ignore given socket flags if not suitable for given IP family or transport ([PR #1294](https://github.com/versatica/mediasoup/pull/1294)).
- Meson: Remove `-Db_pie=true -Db_staticpic=true` args ([PR #1293](https://github.com/versatica/mediasoup/pull/1293)).
- Add RTCP Sender Report trace event ([PR #1267](https://github.com/versatica/mediasoup/pull/1267) by @GithubUser8080).

### 3.13.13

- worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)).
- Worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)).
- liburing: Enable zero copy ([PR #1273](https://github.com/versatica/mediasoup/pull/1273)).
- Fix build on musl based systems (such as Alpine Linux) ([PR #1279](https://github.com/versatica/mediasoup/pull/1279)).

### 3.13.12

- worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
- Worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
- npm installation: Don't require Python if valid worker prebuilt binary is fetched ([PR #1265](https://github.com/versatica/mediasoup/pull/1265)).
- Update h264-profile-level-id NPM dependency to 1.1.0.

Expand Down Expand Up @@ -125,11 +141,11 @@
### 3.13.0

- 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 `TransportListenInfo` 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).
- 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

Expand Down Expand Up @@ -174,7 +190,7 @@

### 3.12.6

- `Worker`: Add `Transport::Destroying()` protected method ([PR #1114](https://github.com/versatica/mediasoup/pull/1114)).
- 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.

Expand Down Expand Up @@ -204,11 +220,11 @@ Migrate `npm-scripts.js` to `npm-scripts.mjs` (ES Module) ([PR #1093](https://gi

### 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)).
- 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)).
- 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 Expand Up @@ -308,7 +324,7 @@ Migrate `npm-scripts.js` to `npm-scripts.mjs` (ES Module) ([PR #1093](https://gi

- Node: Migrate tests to TypeScript ([PR #958](https://github.com/versatica/mediasoup/pull/958)).
- Node: Remove compiled JavaScript from repository and compile TypeScript code on NPM `prepare` script on demand when installed via git ([PR #954](https://github.com/versatica/mediasoup/pull/954)).
- `Worker`: Add `RTC::Shared` singleton for RTC entities ([PR #953](https://github.com/versatica/mediasoup/pull/953)).
- Worker: Add `RTC::Shared` singleton for RTC entities ([PR #953](https://github.com/versatica/mediasoup/pull/953)).
- Update OpenSSL to 3.0.7.

### 3.11.3
Expand Down Expand Up @@ -484,7 +500,7 @@ Migrate `npm-scripts.js` to `npm-scripts.mjs` (ES Module) ([PR #1093](https://gi

### 3.9.4

- `Worker`: Fix bad printing of error messages from Worker ([PR #750](https://github.com/versatica/mediasoup/pull/750) by @j1elo).
- Worker: Fix bad printing of error messages from Worker ([PR #750](https://github.com/versatica/mediasoup/pull/750) by @j1elo).

### 3.9.3

Expand All @@ -502,7 +518,7 @@ Migrate `npm-scripts.js` to `npm-scripts.mjs` (ES Module) ([PR #1093](https://gi
### 3.9.1

- NixOS friendly build process ([PR #683](https://github.com/versatica/mediasoup/pull/683)).
- `Worker`: Emit "died" event before observer "close" ([PR #684](https://github.com/versatica/mediasoup/pull/684)).
- Worker: Emit "died" event before observer "close" ([PR #684](https://github.com/versatica/mediasoup/pull/684)).
- Transport: Hide debug message for RTX RTCP-RR packets ([PR #688](https://github.com/versatica/mediasoup/pull/688)).
- Update `libuv` to 1.42.0.
- Improve Windows support ([PR #692](https://github.com/versatica/mediasoup/pull/692)).
Expand Down
2 changes: 1 addition & 1 deletion node/src/ActiveSpeakerObserver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import {
RtpObserver,
RtpObserverEvents,
Expand Down
2 changes: 1 addition & 1 deletion node/src/AudioLevelObserver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import {
RtpObserver,
RtpObserverEvents,
Expand Down
9 changes: 4 additions & 5 deletions node/src/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as os from 'node:os';
import { Duplex } from 'node:stream';
import { info, warn } from 'node:console';
import * as flatbuffers from 'flatbuffers';
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import { InvalidStateError } from './errors';
import { Body as RequestBody, Method, Request } from './fbs/request';
import { Response } from './fbs/response';
Expand Down Expand Up @@ -156,8 +157,7 @@ export class Channel extends EnhancedEventEmitter {
}

default: {
// eslint-disable-next-line no-console
console.warn(
warn(
`worker[pid:${pid}] unexpected data: ${payload.toString(
'utf8',
1
Expand Down Expand Up @@ -482,8 +482,7 @@ export class Channel extends EnhancedEventEmitter {

// 'X' (a dump log).
case 'X': {
// eslint-disable-next-line no-console
console.log(logData.slice(1));
info(logData.slice(1));

break;
}
Expand Down
2 changes: 1 addition & 1 deletion node/src/Consumer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import { Channel } from './Channel';
import { TransportInternal } from './Transport';
import { ProducerStat } from './Producer';
Expand Down
2 changes: 1 addition & 1 deletion node/src/DataConsumer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import { Channel } from './Channel';
import { TransportInternal } from './Transport';
import {
Expand Down
2 changes: 1 addition & 1 deletion node/src/DataProducer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import { Channel } from './Channel';
import { TransportInternal } from './Transport';
import {
Expand Down
2 changes: 1 addition & 1 deletion node/src/Producer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
import { EnhancedEventEmitter } from './enhancedEvents';
import { Channel } from './Channel';
import { TransportInternal } from './Transport';
import { MediaKind, RtpParameters, parseRtpParameters } from './RtpParameters';
Expand Down

0 comments on commit 69480f9

Please sign in to comment.