mediasoup 3.9.2 → 3.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node/lib/Channel.js +1 -1
- package/node/lib/PayloadChannel.js +1 -1
- package/node/lib/Worker.js +1 -1
- package/node/lib/index.d.ts +1 -1
- package/node/lib/index.js +1 -1
- package/node/lib/ortc.js +4 -6
- package/node/lib/supportedRtpCapabilities.d.ts.map +1 -1
- package/node/lib/supportedRtpCapabilities.js +14 -34
- package/npm-scripts.js +6 -2
- package/package.json +12 -12
- package/worker/Makefile +49 -19
- package/worker/include/Channel/ChannelNotifier.hpp +1 -0
- package/worker/include/Channel/ChannelSocket.hpp +16 -5
- package/worker/include/Logger.hpp +1 -1
- package/worker/include/PayloadChannel/PayloadChannelSocket.hpp +17 -4
- package/worker/include/RTC/IceServer.hpp +7 -5
- package/worker/include/RTC/RTCP/CompoundPacket.hpp +4 -3
- package/worker/include/RTC/RTCP/FeedbackPsTst.hpp +11 -1
- package/worker/include/RTC/RTCP/ReceiverReport.hpp +3 -2
- package/worker/include/RTC/RtpDictionaries.hpp +2 -1
- package/worker/include/RTC/RtpHeaderExtensionIds.hpp +1 -0
- package/worker/include/RTC/StunPacket.hpp +24 -5
- package/worker/include/RTC/TransportCongestionControlClient.hpp +3 -0
- package/worker/include/common.hpp +39 -0
- package/worker/include/lib.hpp +12 -2
- package/worker/meson.build +8 -0
- package/worker/scripts/package-lock.json +9913 -0
- package/worker/src/Channel/ChannelNotifier.cpp +14 -0
- package/worker/src/Channel/ChannelSocket.cpp +141 -14
- package/worker/src/DepOpenSSL.cpp +8 -5
- package/worker/src/Logger.cpp +1 -1
- package/worker/src/PayloadChannel/PayloadChannelSocket.cpp +226 -17
- package/worker/src/RTC/ActiveSpeakerObserver.cpp +1 -1
- package/worker/src/RTC/DataConsumer.cpp +9 -6
- package/worker/src/RTC/IceServer.cpp +93 -33
- package/worker/src/RTC/Producer.cpp +20 -0
- package/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp +2 -1
- package/worker/src/RTC/StunPacket.cpp +17 -0
- package/worker/src/RTC/Transport.cpp +48 -36
- package/worker/src/RTC/TransportCongestionControlClient.cpp +89 -22
- package/worker/src/RTC/WebRtcTransport.cpp +1 -2
- package/worker/src/Worker.cpp +9 -9
- package/worker/src/lib.cpp +29 -5
- package/worker/src/lib.rs +88 -2
- package/worker/src/main.cpp +10 -2
- package/worker/subprojects/libuv.wrap +7 -7
package/node/lib/Channel.js
CHANGED
|
@@ -207,7 +207,7 @@ class Channel extends EnhancedEventEmitter_1.EnhancedEventEmitter {
|
|
|
207
207
|
// the response, destroying the ordered delivery. So we must wait a bit
|
|
208
208
|
// here.
|
|
209
209
|
// See https://github.com/versatica/mediasoup/issues/510
|
|
210
|
-
setImmediate(() => this.emit(msg.targetId, msg.event, msg.data));
|
|
210
|
+
setImmediate(() => this.emit(String(msg.targetId), msg.event, msg.data));
|
|
211
211
|
}
|
|
212
212
|
// Otherwise unexpected message.
|
|
213
213
|
else {
|
|
@@ -213,7 +213,7 @@ class PayloadChannel extends EnhancedEventEmitter_1.EnhancedEventEmitter {
|
|
|
213
213
|
else if (msg.targetId && msg.event) {
|
|
214
214
|
this.#ongoingNotification =
|
|
215
215
|
{
|
|
216
|
-
targetId: msg.targetId,
|
|
216
|
+
targetId: String(msg.targetId),
|
|
217
217
|
event: msg.event,
|
|
218
218
|
data: msg.data
|
|
219
219
|
};
|
package/node/lib/Worker.js
CHANGED
|
@@ -81,7 +81,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
|
|
|
81
81
|
// options
|
|
82
82
|
{
|
|
83
83
|
env: {
|
|
84
|
-
MEDIASOUP_VERSION: '3.9.
|
|
84
|
+
MEDIASOUP_VERSION: '3.9.6',
|
|
85
85
|
// Let the worker process inherit all environment variables, useful
|
|
86
86
|
// if a custom and not in the path GCC is used so the user can set
|
|
87
87
|
// LD_LIBRARY_PATH environment variable for runtime.
|
package/node/lib/index.d.ts
CHANGED
package/node/lib/index.js
CHANGED
package/node/lib/ortc.js
CHANGED
|
@@ -829,12 +829,11 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {}) {
|
|
|
829
829
|
}
|
|
830
830
|
case 'video/h264':
|
|
831
831
|
{
|
|
832
|
-
const aPacketizationMode = aCodec.parameters['packetization-mode'] || 0;
|
|
833
|
-
const bPacketizationMode = bCodec.parameters['packetization-mode'] || 0;
|
|
834
|
-
if (aPacketizationMode !== bPacketizationMode)
|
|
835
|
-
return false;
|
|
836
|
-
// If strict matching check profile-level-id.
|
|
837
832
|
if (strict) {
|
|
833
|
+
const aPacketizationMode = aCodec.parameters['packetization-mode'] || 0;
|
|
834
|
+
const bPacketizationMode = bCodec.parameters['packetization-mode'] || 0;
|
|
835
|
+
if (aPacketizationMode !== bPacketizationMode)
|
|
836
|
+
return false;
|
|
838
837
|
if (!h264.isSameProfile(aCodec.parameters, bCodec.parameters))
|
|
839
838
|
return false;
|
|
840
839
|
let selectedProfileLevelId;
|
|
@@ -856,7 +855,6 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {}) {
|
|
|
856
855
|
}
|
|
857
856
|
case 'video/vp9':
|
|
858
857
|
{
|
|
859
|
-
// If strict matching check profile-id.
|
|
860
858
|
if (strict) {
|
|
861
859
|
const aProfileId = aCodec.parameters['profile-id'] || 0;
|
|
862
860
|
const bProfileId = bCodec.parameters['profile-id'] || 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,eAgX/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -207,39 +207,6 @@ const supportedRtpCapabilities = {
|
|
|
207
207
|
mimeType: 'video/H264',
|
|
208
208
|
clockRate: 90000,
|
|
209
209
|
parameters: {
|
|
210
|
-
'packetization-mode': 1,
|
|
211
|
-
'level-asymmetry-allowed': 1
|
|
212
|
-
},
|
|
213
|
-
rtcpFeedback: [
|
|
214
|
-
{ type: 'nack' },
|
|
215
|
-
{ type: 'nack', parameter: 'pli' },
|
|
216
|
-
{ type: 'ccm', parameter: 'fir' },
|
|
217
|
-
{ type: 'goog-remb' },
|
|
218
|
-
{ type: 'transport-cc' }
|
|
219
|
-
]
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
kind: 'video',
|
|
223
|
-
mimeType: 'video/H264',
|
|
224
|
-
clockRate: 90000,
|
|
225
|
-
parameters: {
|
|
226
|
-
'packetization-mode': 0,
|
|
227
|
-
'level-asymmetry-allowed': 1
|
|
228
|
-
},
|
|
229
|
-
rtcpFeedback: [
|
|
230
|
-
{ type: 'nack' },
|
|
231
|
-
{ type: 'nack', parameter: 'pli' },
|
|
232
|
-
{ type: 'ccm', parameter: 'fir' },
|
|
233
|
-
{ type: 'goog-remb' },
|
|
234
|
-
{ type: 'transport-cc' }
|
|
235
|
-
]
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
kind: 'video',
|
|
239
|
-
mimeType: 'video/H265',
|
|
240
|
-
clockRate: 90000,
|
|
241
|
-
parameters: {
|
|
242
|
-
'packetization-mode': 1,
|
|
243
210
|
'level-asymmetry-allowed': 1
|
|
244
211
|
},
|
|
245
212
|
rtcpFeedback: [
|
|
@@ -255,7 +222,6 @@ const supportedRtpCapabilities = {
|
|
|
255
222
|
mimeType: 'video/H265',
|
|
256
223
|
clockRate: 90000,
|
|
257
224
|
parameters: {
|
|
258
|
-
'packetization-mode': 0,
|
|
259
225
|
'level-asymmetry-allowed': 1
|
|
260
226
|
},
|
|
261
227
|
rtcpFeedback: [
|
|
@@ -360,6 +326,20 @@ const supportedRtpCapabilities = {
|
|
|
360
326
|
preferredId: 12,
|
|
361
327
|
preferredEncrypt: false,
|
|
362
328
|
direction: 'sendrecv'
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
kind: 'video',
|
|
332
|
+
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time',
|
|
333
|
+
preferredId: 13,
|
|
334
|
+
preferredEncrypt: false,
|
|
335
|
+
direction: 'sendrecv'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
kind: 'audio',
|
|
339
|
+
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time',
|
|
340
|
+
preferredId: 13,
|
|
341
|
+
preferredEncrypt: false,
|
|
342
|
+
direction: 'sendrecv'
|
|
363
343
|
}
|
|
364
344
|
]
|
|
365
345
|
};
|
package/npm-scripts.js
CHANGED
|
@@ -121,8 +121,12 @@ switch (task)
|
|
|
121
121
|
if (!process.env.MEDIASOUP_WORKER_BIN)
|
|
122
122
|
{
|
|
123
123
|
execute('node npm-scripts.js worker:build');
|
|
124
|
-
|
|
124
|
+
// Clean build artifacts except `mediasoup-worker`.
|
|
125
|
+
execute(`${MAKE} clean-build -C worker`);
|
|
126
|
+
// Clean downloaded dependencies.
|
|
125
127
|
execute(`${MAKE} clean-subprojects -C worker`);
|
|
128
|
+
// Clean PIP/Meson/Ninja.
|
|
129
|
+
execute(`${MAKE} clean-pip -C worker`);
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
break;
|
|
@@ -143,7 +147,7 @@ switch (task)
|
|
|
143
147
|
|
|
144
148
|
case 'install-clang-tools':
|
|
145
149
|
{
|
|
146
|
-
execute('npm
|
|
150
|
+
execute('npm ci --prefix worker/scripts');
|
|
147
151
|
|
|
148
152
|
break;
|
|
149
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.6",
|
|
4
4
|
"description": "Cutting Edge WebRTC Video Conferencing",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -69,27 +69,27 @@
|
|
|
69
69
|
"testRegex": "node/tests/test.*\\.js"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@types/node": "^16.11.
|
|
73
|
-
"debug": "^4.3.
|
|
72
|
+
"@types/node": "^16.11.10",
|
|
73
|
+
"debug": "^4.3.3",
|
|
74
74
|
"h264-profile-level-id": "^1.0.1",
|
|
75
75
|
"random-number": "^0.0.9",
|
|
76
|
-
"supports-color": "^9.
|
|
76
|
+
"supports-color": "^9.2.1",
|
|
77
77
|
"uuid": "^8.3.2"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/debug": "^4.1.7",
|
|
81
81
|
"@types/random-number": "^0.0.1",
|
|
82
|
-
"@types/uuid": "^8.3.
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
84
|
-
"@typescript-eslint/parser": "^5.
|
|
85
|
-
"eslint": "^8.
|
|
86
|
-
"eslint-plugin-jest": "^
|
|
87
|
-
"jest": "^27.
|
|
82
|
+
"@types/uuid": "^8.3.4",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
|
84
|
+
"@typescript-eslint/parser": "^5.10.1",
|
|
85
|
+
"eslint": "^8.7.0",
|
|
86
|
+
"eslint-plugin-jest": "^26.0.0",
|
|
87
|
+
"jest": "^27.4.7",
|
|
88
88
|
"jest-tobetype": "^1.2.3",
|
|
89
89
|
"open-cli": "^7.0.1",
|
|
90
90
|
"pick-port": "^1.0.0",
|
|
91
91
|
"sctp": "^1.0.0",
|
|
92
|
-
"tsc-watch": "^4.
|
|
93
|
-
"typescript": "^4.
|
|
92
|
+
"tsc-watch": "^4.6.0",
|
|
93
|
+
"typescript": "^4.5.5"
|
|
94
94
|
}
|
|
95
95
|
}
|
package/worker/Makefile
CHANGED
|
@@ -12,6 +12,8 @@ GULP = ./scripts/node_modules/.bin/gulp
|
|
|
12
12
|
LCOV = ./deps/lcov/bin/lcov
|
|
13
13
|
DOCKER ?= docker
|
|
14
14
|
PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
|
|
15
|
+
INSTALL_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
|
|
16
|
+
BUILD_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/build
|
|
15
17
|
MESON ?= $(PIP_DIR)/bin/meson
|
|
16
18
|
MESON_ARGS ?= ""
|
|
17
19
|
# Workaround for NixOS and Guix that don't work with pre-built binaries, see:
|
|
@@ -37,6 +39,13 @@ else
|
|
|
37
39
|
export PYTHONPATH := $(PIP_DIR):${PYTHONPATH}
|
|
38
40
|
endif
|
|
39
41
|
|
|
42
|
+
# Activate VS environment on Windows by default.
|
|
43
|
+
ifeq ($(OS),Windows_NT)
|
|
44
|
+
ifeq ($(MESON_ARGS),"")
|
|
45
|
+
MESON_ARGS = $(subst $\",,"--vsenv")
|
|
46
|
+
endif
|
|
47
|
+
endif
|
|
48
|
+
|
|
40
49
|
.PHONY: \
|
|
41
50
|
default meson-ninja setup clean clean-pip clean-subprojects clean-all mediasoup-worker xcode lint format test tidy \
|
|
42
51
|
fuzzer fuzzer-run-all docker-build docker-run libmediasoup-worker
|
|
@@ -63,56 +72,77 @@ setup: meson-ninja
|
|
|
63
72
|
# https://github.com/ninja-build/ninja/issues/1997
|
|
64
73
|
ifeq ($(MEDIASOUP_BUILDTYPE),Release)
|
|
65
74
|
$(MESON) setup \
|
|
75
|
+
--prefix $(INSTALL_DIR) \
|
|
76
|
+
--bindir '' \
|
|
77
|
+
--libdir '' \
|
|
66
78
|
--buildtype release \
|
|
67
79
|
-Db_ndebug=true \
|
|
68
80
|
-Db_pie=true \
|
|
69
81
|
-Db_staticpic=true \
|
|
70
82
|
--reconfigure \
|
|
71
83
|
$(MESON_ARGS) \
|
|
72
|
-
$(
|
|
84
|
+
$(BUILD_DIR) || \
|
|
73
85
|
$(MESON) setup \
|
|
86
|
+
--prefix $(INSTALL_DIR) \
|
|
87
|
+
--bindir '' \
|
|
88
|
+
--libdir '' \
|
|
74
89
|
--buildtype release \
|
|
75
90
|
-Db_ndebug=true \
|
|
76
91
|
-Db_pie=true \
|
|
77
92
|
-Db_staticpic=true \
|
|
78
93
|
$(MESON_ARGS) \
|
|
79
|
-
$(
|
|
94
|
+
$(BUILD_DIR)
|
|
80
95
|
else
|
|
81
96
|
ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
|
|
82
97
|
$(MESON) setup \
|
|
98
|
+
--prefix $(INSTALL_DIR) \
|
|
99
|
+
--bindir '' \
|
|
100
|
+
--libdir '' \
|
|
83
101
|
--buildtype debug \
|
|
84
102
|
-Db_pie=true \
|
|
85
103
|
-Db_staticpic=true \
|
|
86
104
|
--reconfigure \
|
|
87
105
|
$(MESON_ARGS) \
|
|
88
|
-
$(
|
|
106
|
+
$(BUILD_DIR) || \
|
|
89
107
|
$(MESON) setup \
|
|
108
|
+
--prefix $(INSTALL_DIR) \
|
|
109
|
+
--bindir '' \
|
|
110
|
+
--libdir '' \
|
|
90
111
|
--buildtype debug \
|
|
91
112
|
-Db_pie=true \
|
|
92
113
|
-Db_staticpic=true \
|
|
93
114
|
$(MESON_ARGS) \
|
|
94
|
-
$(
|
|
115
|
+
$(BUILD_DIR)
|
|
95
116
|
else
|
|
96
117
|
$(MESON) setup \
|
|
118
|
+
--prefix $(INSTALL_DIR) \
|
|
119
|
+
--bindir '' \
|
|
120
|
+
--libdir '' \
|
|
97
121
|
--buildtype $(MEDIASOUP_BUILDTYPE) \
|
|
98
122
|
-Db_ndebug=if-release \
|
|
99
123
|
-Db_pie=true \
|
|
100
124
|
-Db_staticpic=true \
|
|
101
125
|
--reconfigure \
|
|
102
126
|
$(MESON_ARGS) \
|
|
103
|
-
$(
|
|
127
|
+
$(BUILD_DIR) || \
|
|
104
128
|
$(MESON) setup \
|
|
129
|
+
--prefix $(INSTALL_DIR) \
|
|
130
|
+
--bindir '' \
|
|
131
|
+
--libdir '' \
|
|
105
132
|
--buildtype $(MEDIASOUP_BUILDTYPE) \
|
|
106
133
|
-Db_ndebug=if-release \
|
|
107
134
|
-Db_pie=true \
|
|
108
135
|
-Db_staticpic=true \
|
|
109
136
|
$(MESON_ARGS) \
|
|
110
|
-
$(
|
|
137
|
+
$(BUILD_DIR)
|
|
111
138
|
endif
|
|
112
139
|
endif
|
|
113
140
|
|
|
114
141
|
clean:
|
|
115
|
-
$(RM) -rf $(
|
|
142
|
+
$(RM) -rf $(INSTALL_DIR)
|
|
143
|
+
|
|
144
|
+
clean-build:
|
|
145
|
+
$(RM) -rf $(BUILD_DIR)
|
|
116
146
|
|
|
117
147
|
clean-pip:
|
|
118
148
|
$(RM) -rf $(PIP_DIR)
|
|
@@ -125,7 +155,8 @@ clean-all: clean-subprojects
|
|
|
125
155
|
|
|
126
156
|
mediasoup-worker: setup
|
|
127
157
|
ifeq ($(MEDIASOUP_WORKER_BIN),)
|
|
128
|
-
$(MESON) compile -
|
|
158
|
+
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker
|
|
159
|
+
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker
|
|
129
160
|
endif
|
|
130
161
|
|
|
131
162
|
xcode: setup
|
|
@@ -138,16 +169,15 @@ format:
|
|
|
138
169
|
$(GULP) --gulpfile ./scripts/gulpfile.js format:worker
|
|
139
170
|
|
|
140
171
|
test: setup
|
|
141
|
-
|
|
142
|
-
$(MESON)
|
|
172
|
+
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-test
|
|
173
|
+
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-test
|
|
143
174
|
# On Windows lcov doesn't work (at least not yet) and we need to add `.exe` to
|
|
144
175
|
# the binary path.
|
|
145
176
|
ifeq ($(OS),Windows_NT)
|
|
146
|
-
$(
|
|
177
|
+
$(BUILD_DIR)/mediasoup-worker-test.exe --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
|
|
147
178
|
else
|
|
148
179
|
$(LCOV) --directory ./ --zerocounters
|
|
149
|
-
$(
|
|
150
|
-
endif
|
|
180
|
+
$(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
|
|
151
181
|
endif
|
|
152
182
|
|
|
153
183
|
tidy:
|
|
@@ -155,18 +185,17 @@ tidy:
|
|
|
155
185
|
-clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \
|
|
156
186
|
-clang-apply-replacements-binary=./scripts/node_modules/.bin/clang-apply-replacements \
|
|
157
187
|
-header-filter='(Channel/**/*.hpp|DepLibSRTP.hpp|DepLibUV.hpp|DepLibWebRTC.hpp|DepOpenSSL.hpp|DepUsrSCTP.hpp|LogLevel.hpp|Logger.hpp|MediaSoupError.hpp|RTC/**/*.hpp|Settings.hpp|Utils.hpp|Worker.hpp|common.hpp|handles/**/*.hpp)' \
|
|
158
|
-
-p=$(
|
|
188
|
+
-p=$(BUILD_DIR) \
|
|
159
189
|
-j=$(CORES) \
|
|
160
190
|
-checks=$(MEDIASOUP_TIDY_CHECKS) \
|
|
161
191
|
-quiet
|
|
162
192
|
|
|
163
193
|
fuzzer: setup
|
|
164
|
-
|
|
165
|
-
$(MESON)
|
|
166
|
-
endif
|
|
194
|
+
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-fuzzer
|
|
195
|
+
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-fuzzer
|
|
167
196
|
|
|
168
197
|
fuzzer-run-all:
|
|
169
|
-
LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(
|
|
198
|
+
LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(BUILD_DIR)/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus
|
|
170
199
|
|
|
171
200
|
docker-build:
|
|
172
201
|
ifeq ($(DOCKER_NO_CACHE),true)
|
|
@@ -184,4 +213,5 @@ docker-run:
|
|
|
184
213
|
mediasoup/docker:latest
|
|
185
214
|
|
|
186
215
|
libmediasoup-worker: setup
|
|
187
|
-
$(MESON) compile -
|
|
216
|
+
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) libmediasoup-worker
|
|
217
|
+
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags libmediasoup-worker
|
|
@@ -12,6 +12,7 @@ namespace Channel
|
|
|
12
12
|
{
|
|
13
13
|
public:
|
|
14
14
|
static void ClassInit(Channel::ChannelSocket* channel);
|
|
15
|
+
static void Emit(uint64_t targetId, const char* event);
|
|
15
16
|
static void Emit(const std::string& targetId, const char* event);
|
|
16
17
|
static void Emit(const std::string& targetId, const char* event, json& data);
|
|
17
18
|
|
|
@@ -64,16 +64,22 @@ namespace Channel
|
|
|
64
64
|
|
|
65
65
|
public:
|
|
66
66
|
explicit ChannelSocket(int consumerFd, int producerFd);
|
|
67
|
+
explicit ChannelSocket(
|
|
68
|
+
ChannelReadFn channelReadFn,
|
|
69
|
+
ChannelReadCtx channelReadCtx,
|
|
70
|
+
ChannelWriteFn channelWriteFn,
|
|
71
|
+
ChannelWriteCtx channelWriteCtx);
|
|
67
72
|
virtual ~ChannelSocket();
|
|
68
73
|
|
|
69
74
|
public:
|
|
70
75
|
void Close();
|
|
71
76
|
void SetListener(Listener* listener);
|
|
77
|
+
bool CallbackRead();
|
|
72
78
|
void Send(json& jsonMessage);
|
|
73
|
-
void SendLog(char* message, uint32_t messageLen);
|
|
79
|
+
void SendLog(const char* message, uint32_t messageLen);
|
|
74
80
|
|
|
75
81
|
private:
|
|
76
|
-
void SendImpl(const
|
|
82
|
+
void SendImpl(const uint8_t* payload, uint32_t payloadLen);
|
|
77
83
|
|
|
78
84
|
/* Pure virtual methods inherited from ConsumerSocket::Listener. */
|
|
79
85
|
public:
|
|
@@ -85,9 +91,14 @@ namespace Channel
|
|
|
85
91
|
Listener* listener{ nullptr };
|
|
86
92
|
// Others.
|
|
87
93
|
bool closed{ false };
|
|
88
|
-
ConsumerSocket consumerSocket;
|
|
89
|
-
ProducerSocket producerSocket;
|
|
90
|
-
|
|
94
|
+
ConsumerSocket* consumerSocket{ nullptr };
|
|
95
|
+
ProducerSocket* producerSocket{ nullptr };
|
|
96
|
+
ChannelReadFn channelReadFn{ nullptr };
|
|
97
|
+
ChannelReadCtx channelReadCtx{ nullptr };
|
|
98
|
+
ChannelWriteFn channelWriteFn{ nullptr };
|
|
99
|
+
ChannelWriteCtx channelWriteCtx{ nullptr };
|
|
100
|
+
uv_async_t* uvReadHandle{ nullptr };
|
|
101
|
+
uint8_t* writeBuffer{ nullptr };
|
|
91
102
|
};
|
|
92
103
|
} // namespace Channel
|
|
93
104
|
|
|
@@ -132,7 +132,7 @@ public:
|
|
|
132
132
|
static void ClassInit(Channel::ChannelSocket* channel);
|
|
133
133
|
|
|
134
134
|
public:
|
|
135
|
-
static const
|
|
135
|
+
static const uint64_t pid;
|
|
136
136
|
thread_local static Channel::ChannelSocket* channel;
|
|
137
137
|
static const size_t bufferSize {50000};
|
|
138
138
|
thread_local static char buffer[];
|
|
@@ -71,16 +71,24 @@ namespace PayloadChannel
|
|
|
71
71
|
|
|
72
72
|
public:
|
|
73
73
|
explicit PayloadChannelSocket(int consumerFd, int producerFd);
|
|
74
|
+
explicit PayloadChannelSocket(
|
|
75
|
+
PayloadChannelReadFn payloadChannelReadFn,
|
|
76
|
+
PayloadChannelReadCtx payloadChannelReadCtx,
|
|
77
|
+
PayloadChannelWriteFn payloadChannelWriteFn,
|
|
78
|
+
PayloadChannelWriteCtx payloadChannelWriteCtx);
|
|
74
79
|
virtual ~PayloadChannelSocket();
|
|
75
80
|
|
|
76
81
|
public:
|
|
77
82
|
void Close();
|
|
78
83
|
void SetListener(Listener* listener);
|
|
84
|
+
bool CallbackRead();
|
|
79
85
|
void Send(json& jsonMessage, const uint8_t* payload, size_t payloadLen);
|
|
80
86
|
void Send(json& jsonMessage);
|
|
81
87
|
|
|
82
88
|
private:
|
|
83
|
-
void SendImpl(const
|
|
89
|
+
void SendImpl(const uint8_t* message, uint32_t messageLen);
|
|
90
|
+
void SendImpl(
|
|
91
|
+
const uint8_t* message, uint32_t messageLen, const uint8_t* payload, uint32_t payloadLen);
|
|
84
92
|
|
|
85
93
|
/* Pure virtual methods inherited from ConsumerSocket::Listener. */
|
|
86
94
|
public:
|
|
@@ -92,11 +100,16 @@ namespace PayloadChannel
|
|
|
92
100
|
Listener* listener{ nullptr };
|
|
93
101
|
// Others.
|
|
94
102
|
bool closed{ false };
|
|
95
|
-
ConsumerSocket consumerSocket;
|
|
96
|
-
ProducerSocket producerSocket;
|
|
103
|
+
ConsumerSocket* consumerSocket{ nullptr };
|
|
104
|
+
ProducerSocket* producerSocket{ nullptr };
|
|
105
|
+
PayloadChannelReadFn payloadChannelReadFn{ nullptr };
|
|
106
|
+
PayloadChannelReadCtx payloadChannelReadCtx{ nullptr };
|
|
107
|
+
PayloadChannelWriteFn payloadChannelWriteFn{ nullptr };
|
|
108
|
+
PayloadChannelWriteCtx payloadChannelWriteCtx{ nullptr };
|
|
97
109
|
PayloadChannel::Notification* ongoingNotification{ nullptr };
|
|
98
110
|
PayloadChannel::PayloadChannelRequest* ongoingRequest{ nullptr };
|
|
99
|
-
|
|
111
|
+
uv_async_t* uvReadHandle{ nullptr };
|
|
112
|
+
uint8_t* writeBuffer{ nullptr };
|
|
100
113
|
};
|
|
101
114
|
} // namespace PayloadChannel
|
|
102
115
|
|
|
@@ -61,15 +61,15 @@ namespace RTC
|
|
|
61
61
|
{
|
|
62
62
|
return this->selectedTuple;
|
|
63
63
|
}
|
|
64
|
-
void
|
|
64
|
+
void RestartIce(const std::string& usernameFragment, const std::string& password)
|
|
65
65
|
{
|
|
66
66
|
this->oldUsernameFragment = this->usernameFragment;
|
|
67
67
|
this->usernameFragment = usernameFragment;
|
|
68
|
-
|
|
69
|
-
void SetPassword(const std::string& password)
|
|
70
|
-
{
|
|
68
|
+
|
|
71
69
|
this->oldPassword = this->password;
|
|
72
70
|
this->password = password;
|
|
71
|
+
|
|
72
|
+
this->remoteNomination = 0u;
|
|
73
73
|
}
|
|
74
74
|
bool IsValidTuple(const RTC::TransportTuple* tuple) const;
|
|
75
75
|
void RemoveTuple(RTC::TransportTuple* tuple);
|
|
@@ -78,7 +78,8 @@ namespace RTC
|
|
|
78
78
|
void ForceSelectedTuple(const RTC::TransportTuple* tuple);
|
|
79
79
|
|
|
80
80
|
private:
|
|
81
|
-
void HandleTuple(
|
|
81
|
+
void HandleTuple(
|
|
82
|
+
RTC::TransportTuple* tuple, bool hasUseCandidate, bool hasNomination, uint32_t nomination);
|
|
82
83
|
/**
|
|
83
84
|
* Store the given tuple and return its stored address.
|
|
84
85
|
*/
|
|
@@ -101,6 +102,7 @@ namespace RTC
|
|
|
101
102
|
std::string password;
|
|
102
103
|
std::string oldUsernameFragment;
|
|
103
104
|
std::string oldPassword;
|
|
105
|
+
uint32_t remoteNomination{ 0u };
|
|
104
106
|
IceState state{ IceState::NEW };
|
|
105
107
|
std::list<RTC::TransportTuple> tuples;
|
|
106
108
|
RTC::TransportTuple* selectedTuple{ nullptr };
|
|
@@ -46,9 +46,10 @@ namespace RTC
|
|
|
46
46
|
bool HasReceiverReferenceTime()
|
|
47
47
|
{
|
|
48
48
|
return std::any_of(
|
|
49
|
-
this->xrPacket.Begin(),
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
this->xrPacket.Begin(),
|
|
50
|
+
this->xrPacket.End(),
|
|
51
|
+
[](const ExtendedReportBlock* report)
|
|
52
|
+
{ return report->GetType() == ExtendedReportBlock::Type::RRT; });
|
|
52
53
|
}
|
|
53
54
|
void Serialize(uint8_t* data);
|
|
54
55
|
|
|
@@ -24,6 +24,12 @@ namespace RTC
|
|
|
24
24
|
class FeedbackPsTstItem : public FeedbackItem
|
|
25
25
|
{
|
|
26
26
|
public:
|
|
27
|
+
#ifdef _WIN32
|
|
28
|
+
#pragma pack(push, 1)
|
|
29
|
+
#define MEDIASOUP_PACKED
|
|
30
|
+
#else
|
|
31
|
+
#define MEDIASOUP_PACKED __attribute__((packed))
|
|
32
|
+
#endif
|
|
27
33
|
struct Header
|
|
28
34
|
{
|
|
29
35
|
uint32_t ssrc;
|
|
@@ -36,7 +42,11 @@ namespace RTC
|
|
|
36
42
|
uint8_t reserved2 : 3;
|
|
37
43
|
uint8_t index : 5;
|
|
38
44
|
#endif
|
|
39
|
-
};
|
|
45
|
+
} MEDIASOUP_PACKED;
|
|
46
|
+
#ifdef _WIN32
|
|
47
|
+
#pragma pack(pop)
|
|
48
|
+
#endif
|
|
49
|
+
#undef MEDIASOUP_PACKED
|
|
40
50
|
|
|
41
51
|
public:
|
|
42
52
|
static const size_t HeaderSize{ 8 };
|
|
@@ -82,8 +82,9 @@ namespace RTC
|
|
|
82
82
|
void SetTotalLost(int32_t totalLost)
|
|
83
83
|
{
|
|
84
84
|
// Get the limit value for possitive and negative totalLost.
|
|
85
|
-
int32_t clamp = (totalLost >= 0)
|
|
86
|
-
|
|
85
|
+
int32_t clamp = (totalLost >= 0) ? totalLost > 0x07FFFFF ? 0x07FFFFF : totalLost
|
|
86
|
+
: -totalLost > 0x0800000 ? 0x0800000
|
|
87
|
+
: -totalLost;
|
|
87
88
|
|
|
88
89
|
uint32_t value = (totalLost >= 0) ? (clamp & 0x07FFFFF) : (clamp | 0x0800000);
|
|
89
90
|
|
|
@@ -41,7 +41,8 @@ namespace RTC
|
|
|
41
41
|
ALTERNATE_SERVER = 0x8023,
|
|
42
42
|
FINGERPRINT = 0x8028,
|
|
43
43
|
ICE_CONTROLLED = 0x8029,
|
|
44
|
-
ICE_CONTROLLING = 0x802A
|
|
44
|
+
ICE_CONTROLLING = 0x802A,
|
|
45
|
+
NOMINATION = 0xC001
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
// Authentication result.
|
|
@@ -114,6 +115,10 @@ namespace RTC
|
|
|
114
115
|
{
|
|
115
116
|
this->hasUseCandidate = true;
|
|
116
117
|
}
|
|
118
|
+
void SetNomination(uint32_t nomination)
|
|
119
|
+
{
|
|
120
|
+
this->nomination = nomination;
|
|
121
|
+
}
|
|
117
122
|
void SetXorMappedAddress(const struct sockaddr* xorMappedAddress)
|
|
118
123
|
{
|
|
119
124
|
this->xorMappedAddress = xorMappedAddress;
|
|
@@ -150,6 +155,18 @@ namespace RTC
|
|
|
150
155
|
{
|
|
151
156
|
return this->hasUseCandidate;
|
|
152
157
|
}
|
|
158
|
+
void SetHasNomination()
|
|
159
|
+
{
|
|
160
|
+
this->hasNomination = true;
|
|
161
|
+
}
|
|
162
|
+
bool HasNomination() const
|
|
163
|
+
{
|
|
164
|
+
return this->hasNomination;
|
|
165
|
+
}
|
|
166
|
+
uint32_t GetNomination() const
|
|
167
|
+
{
|
|
168
|
+
return this->nomination;
|
|
169
|
+
}
|
|
153
170
|
uint16_t GetErrorCode() const
|
|
154
171
|
{
|
|
155
172
|
return this->errorCode;
|
|
@@ -177,10 +194,12 @@ namespace RTC
|
|
|
177
194
|
uint8_t* data{ nullptr }; // Pointer to binary data.
|
|
178
195
|
size_t size{ 0u }; // The full message size (including header).
|
|
179
196
|
// STUN attributes.
|
|
180
|
-
std::string username;
|
|
181
|
-
uint32_t priority{ 0u };
|
|
182
|
-
uint64_t iceControlling{ 0u };
|
|
183
|
-
uint64_t iceControlled{ 0u };
|
|
197
|
+
std::string username; // Less than 513 bytes.
|
|
198
|
+
uint32_t priority{ 0u }; // 4 bytes unsigned integer.
|
|
199
|
+
uint64_t iceControlling{ 0u }; // 8 bytes unsigned integer.
|
|
200
|
+
uint64_t iceControlled{ 0u }; // 8 bytes unsigned integer.
|
|
201
|
+
bool hasNomination{ false };
|
|
202
|
+
uint32_t nomination{ 0u }; // 4 bytes unsigned integer.
|
|
184
203
|
bool hasUseCandidate{ false }; // 0 bytes.
|
|
185
204
|
const uint8_t* messageIntegrity{ nullptr }; // 20 bytes.
|
|
186
205
|
bool hasFingerprint{ false }; // 4 bytes.
|