mediasoup 3.12.4 → 3.12.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.
@@ -90,7 +90,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
90
90
  // options
91
91
  {
92
92
  env: {
93
- MEDIASOUP_VERSION: '3.12.4',
93
+ MEDIASOUP_VERSION: '3.12.6',
94
94
  // Let the worker process inherit all environment variables, useful
95
95
  // if a custom and not in the path GCC is used so the user can set
96
96
  // LD_LIBRARY_PATH environment variable for runtime.
@@ -10,7 +10,7 @@ export { types };
10
10
  /**
11
11
  * Expose mediasoup version.
12
12
  */
13
- export declare const version = "3.12.4";
13
+ export declare const version = "3.12.6";
14
14
  /**
15
15
  * Expose parseScalabilityMode() function.
16
16
  */
package/node/lib/index.js CHANGED
@@ -11,7 +11,7 @@ exports.types = types;
11
11
  /**
12
12
  * Expose mediasoup version.
13
13
  */
14
- exports.version = '3.12.4';
14
+ exports.version = '3.12.6';
15
15
  /**
16
16
  * Expose parseScalabilityMode() function.
17
17
  */
@@ -11,7 +11,7 @@ test('mediasoup.getSupportedRtpCapabilities() returns the mediasoup RTP capabili
11
11
  rtpCapabilities.codecs = 'bar';
12
12
  const rtpCapabilities2 = getSupportedRtpCapabilities();
13
13
  expect(rtpCapabilities2).not.toEqual(rtpCapabilities);
14
- }, 500);
14
+ });
15
15
  test('parseScalabilityMode() works', () => {
16
16
  expect(parseScalabilityMode('L1T3'))
17
17
  .toEqual({ spatialLayers: 1, temporalLayers: 3, ksvc: false });
@@ -33,4 +33,4 @@ test('parseScalabilityMode() works', () => {
33
33
  .toEqual({ spatialLayers: 1, temporalLayers: 1, ksvc: false });
34
34
  expect(parseScalabilityMode('L4T7_KEY_SHIFT'))
35
35
  .toEqual({ spatialLayers: 4, temporalLayers: 7, ksvc: true });
36
- }, 500);
36
+ });
@@ -17,7 +17,7 @@ export * from './RtpParameters';
17
17
  export * from './SctpParameters';
18
18
  export * from './SrtpParameters';
19
19
  export * from './errors';
20
- export { ScalabilityMode } from './scalabilityModes';
20
+ export type { ScalabilityMode } from './scalabilityModes';
21
21
  export type AppData = {
22
22
  [key: string]: unknown;
23
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,OAAO,GACnB;IACC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,OAAO,GACnB;IACC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC"}
package/npm-scripts.mjs CHANGED
@@ -103,15 +103,8 @@ async function run()
103
103
 
104
104
  case 'typescript:watch':
105
105
  {
106
- // NOTE: Load dep on demand since it's a devDependency.
107
- const { TscWatchClient } = await import('tsc-watch/client.js');
108
-
109
- const watch = new TscWatchClient();
110
-
111
106
  deleteNodeLib();
112
-
113
- watch.on('success', replaceVersion);
114
- watch.start('--project', 'node', '--pretty');
107
+ executeCmd('tsc --project node --watch');
115
108
 
116
109
  break;
117
110
  }
@@ -211,11 +204,11 @@ async function run()
211
204
  catch (error)
212
205
  {
213
206
  logError(error.message);
207
+
214
208
  exitWithError();
215
209
  }
216
210
 
217
211
  checkRelease();
218
-
219
212
  executeCmd(`git commit -am '${PKG.version}'`);
220
213
  executeCmd(`git tag -a ${PKG.version} -m '${PKG.version}'`);
221
214
  executeCmd(`git push origin v${MAYOR_VERSION}`);
@@ -250,7 +243,6 @@ async function run()
250
243
  case 'release:upload-mac-arm-prebuilt-worker':
251
244
  {
252
245
  checkRelease();
253
-
254
246
  await prebuildWorker();
255
247
  await uploadMacArmPrebuiltWorker();
256
248
 
@@ -270,19 +262,24 @@ function replaceVersion()
270
262
  {
271
263
  logInfo('replaceVersion()');
272
264
 
273
- const files =
274
- [
275
- 'node/lib/index.js',
276
- 'node/lib/index.d.ts',
277
- 'node/lib/Worker.js'
278
- ];
265
+ const files = fs.readdirSync('node/lib',
266
+ {
267
+ withFileTypes : true,
268
+ recursive : true
269
+ });
279
270
 
280
271
  for (const file of files)
281
272
  {
282
- const text = fs.readFileSync(file, { encoding: 'utf8' });
273
+ if (!file.isFile())
274
+ {
275
+ continue;
276
+ }
277
+
278
+ const filePath = path.join('node/lib', file.name);
279
+ const text = fs.readFileSync(filePath, { encoding: 'utf8' });
283
280
  const result = text.replace(/__MEDIASOUP_VERSION__/g, PKG.version);
284
281
 
285
- fs.writeFileSync(file, result, { encoding: 'utf8' });
282
+ fs.writeFileSync(filePath, result, { encoding: 'utf8' });
286
283
  }
287
284
  }
288
285
 
@@ -430,6 +427,7 @@ function installMsysMake()
430
427
  if (res.status !== 0)
431
428
  {
432
429
  logError('`installMsysMake() | cannot find Python executable');
430
+
433
431
  exitWithError();
434
432
  }
435
433
  }
@@ -687,6 +685,7 @@ function executeCmd(command, exitOnError = true)
687
685
  if (exitOnError)
688
686
  {
689
687
  logError(`executeCmd() failed, exiting: ${error}`);
688
+
690
689
  exitWithError();
691
690
  }
692
691
  else
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.12.4",
3
+ "version": "3.12.6",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
7
7
  "José Luis Millán <jmillan@aliax.net> (https://github.com/jmillan)",
8
8
  "Nazar Mokynskyi (https://github.com/nazar-pc)"
9
9
  ],
10
- "homepage": "https://mediasoup.org",
11
10
  "license": "ISC",
11
+ "homepage": "https://mediasoup.org",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/versatica/mediasoup.git"
@@ -38,15 +38,15 @@
38
38
  "worker/meson_options.txt",
39
39
  "npm-scripts.mjs"
40
40
  ],
41
+ "engines": {
42
+ "node": ">=16"
43
+ },
41
44
  "keywords": [
42
45
  "webrtc",
43
46
  "ortc",
44
47
  "sfu",
45
48
  "nodejs"
46
49
  ],
47
- "engines": {
48
- "node": ">=16"
49
- },
50
50
  "scripts": {
51
51
  "prepare": "node npm-scripts.mjs prepare",
52
52
  "postinstall": "node npm-scripts.mjs postinstall",
@@ -90,7 +90,7 @@
90
90
  "debug": "^4.3.4",
91
91
  "h264-profile-level-id": "^1.0.1",
92
92
  "node-fetch": "^3.3.1",
93
- "supports-color": "^9.3.1",
93
+ "supports-color": "^9.4.0",
94
94
  "tar": "^6.1.15",
95
95
  "uuid": "^9.0.0"
96
96
  },
@@ -100,17 +100,16 @@
100
100
  "@types/jest": "^29.5.2",
101
101
  "@types/node": "^18.16.18",
102
102
  "@types/uuid": "^9.0.2",
103
- "@typescript-eslint/eslint-plugin": "^5.60.0",
104
- "@typescript-eslint/parser": "^5.60.0",
105
- "eslint": "^8.43.0",
103
+ "@typescript-eslint/eslint-plugin": "^5.61.0",
104
+ "@typescript-eslint/parser": "^5.61.0",
105
+ "eslint": "^8.44.0",
106
106
  "eslint-plugin-jest": "^27.2.2",
107
- "jest": "^29.5.0",
108
- "marked": "^5.1.0",
107
+ "jest": "^29.6.1",
108
+ "marked": "^5.1.1",
109
109
  "open-cli": "^7.2.0",
110
110
  "pick-port": "^1.0.1",
111
111
  "sctp": "^1.0.0",
112
- "ts-jest": "^29.1.0",
113
- "tsc-watch": "^6.0.4",
114
- "typescript": "^5.1.3"
112
+ "ts-jest": "^29.1.1",
113
+ "typescript": "^5.1.6"
115
114
  }
116
115
  }
package/worker/Makefile CHANGED
@@ -81,6 +81,7 @@ endif
81
81
  lint \
82
82
  format \
83
83
  test \
84
+ test-asan \
84
85
  tidy \
85
86
  fuzzer \
86
87
  fuzzer-run-all \
@@ -225,6 +226,11 @@ else
225
226
  $(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
226
227
  endif
227
228
 
229
+ test-asan: setup
230
+ $(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-test-asan
231
+ $(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-test-asan
232
+ ASAN_OPTIONS=detect_leaks=1 $(BUILD_DIR)/mediasoup-worker-test-asan --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
233
+
228
234
  tidy:
229
235
  $(PYTHON) ./scripts/clang-tidy.py \
230
236
  -clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \
@@ -102,9 +102,9 @@ namespace RTC
102
102
  {
103
103
  return uint32_t{ ntohl(this->header->jitter) };
104
104
  }
105
- void SetJitter(uint32_t jitter)
105
+ void SetJitter(float jitter)
106
106
  {
107
- this->header->jitter = uint32_t{ htonl(jitter) };
107
+ this->header->jitter = uint32_t{ htonl(static_cast<uint32_t>(jitter)) };
108
108
  }
109
109
  uint32_t GetLastSenderReport() const
110
110
  {
@@ -114,7 +114,9 @@ namespace RTC
114
114
  uint64_t lastSrReceived{ 0u };
115
115
  // Relative transit time for prev packet.
116
116
  int32_t transit{ 0u };
117
- uint32_t jitter{ 0u };
117
+ // Jitter in RTP timestamp units. As per spec it's kept as floating value
118
+ // although it's exposed as integer in the stats.
119
+ float jitter{ 0 };
118
120
  uint8_t firSeqNumber{ 0u };
119
121
  uint32_t reportedPacketLost{ 0u };
120
122
  std::unique_ptr<RTC::NackGenerator> nackGenerator;
@@ -144,6 +144,7 @@ namespace RTC
144
144
 
145
145
  protected:
146
146
  // Must be called from the subclass.
147
+ void Destroying();
147
148
  void Connected();
148
149
  void Disconnected();
149
150
  void DataReceived(size_t len)
@@ -280,15 +280,7 @@ executable(
280
280
  cpp_args: cpp_args + ['-DMS_EXECUTABLE'],
281
281
  )
282
282
 
283
- mediasoup_worker_test = executable(
284
- 'mediasoup-worker-test',
285
- build_by_default: false,
286
- install: true,
287
- install_tag: 'mediasoup-worker-test',
288
- dependencies: dependencies + [
289
- catch2_proj.get_variable('catch2_dep'),
290
- ],
291
- sources: common_sources + [
283
+ test_sources = [
292
284
  'test/src/tests.cpp',
293
285
  'test/src/PayloadChannel/TestPayloadChannelNotification.cpp',
294
286
  'test/src/PayloadChannel/TestPayloadChannelRequest.cpp',
@@ -333,7 +325,17 @@ mediasoup_worker_test = executable(
333
325
  'test/src/Utils/TestJson.cpp',
334
326
  'test/src/Utils/TestString.cpp',
335
327
  'test/src/Utils/TestTime.cpp',
328
+ ]
329
+
330
+ mediasoup_worker_test = executable(
331
+ 'mediasoup-worker-test',
332
+ build_by_default: false,
333
+ install: true,
334
+ install_tag: 'mediasoup-worker-test',
335
+ dependencies: dependencies + [
336
+ catch2_proj.get_variable('catch2_dep'),
336
337
  ],
338
+ sources: common_sources + test_sources,
337
339
  include_directories: include_directories(
338
340
  'include',
339
341
  'test/include',
@@ -350,6 +352,35 @@ test(
350
352
  workdir: meson.project_source_root(),
351
353
  )
352
354
 
355
+ mediasoup_worker_test_asan = executable(
356
+ 'mediasoup-worker-test-asan',
357
+ build_by_default: false,
358
+ install: true,
359
+ install_tag: 'mediasoup-worker-test-asan',
360
+ dependencies: dependencies + [
361
+ catch2_proj.get_variable('catch2_dep'),
362
+ ],
363
+ sources: common_sources + test_sources,
364
+ include_directories: include_directories(
365
+ 'include',
366
+ 'test/include',
367
+ ),
368
+ cpp_args: cpp_args + [
369
+ '-DMS_LOG_STD',
370
+ '-DMS_TEST',
371
+ '-fsanitize=address',
372
+ ],
373
+ link_args: [
374
+ '-fsanitize=address',
375
+ ],
376
+ )
377
+
378
+ test(
379
+ 'mediasoup-worker-test-asan',
380
+ mediasoup_worker_test_asan,
381
+ workdir: meson.project_source_root(),
382
+ )
383
+
353
384
  executable(
354
385
  'mediasoup-worker-fuzzer',
355
386
  build_by_default: false,
@@ -212,6 +212,8 @@ namespace RTC
212
212
 
213
213
  data.append(std::to_string(this->bufferedAmount));
214
214
  data.append("}");
215
+
216
+ this->shared->channelNotifier->Emit(this->id, "bufferedamountlow", data);
215
217
  }
216
218
  // Force the trigger of 'bufferedamountlow' once there is less or same
217
219
  // buffered data than the given threshold.
@@ -28,6 +28,10 @@ namespace RTC
28
28
  {
29
29
  MS_TRACE();
30
30
 
31
+ // Tell the Transport parent class that we are about to destroy
32
+ // the class instance.
33
+ Destroying();
34
+
31
35
  this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
32
36
  }
33
37
 
@@ -117,6 +117,10 @@ namespace RTC
117
117
  {
118
118
  MS_TRACE();
119
119
 
120
+ // Tell the Transport parent class that we are about to destroy
121
+ // the class instance.
122
+ Destroying();
123
+
120
124
  this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
121
125
 
122
126
  delete this->udpSocket;
@@ -206,6 +206,10 @@ namespace RTC
206
206
  {
207
207
  MS_TRACE();
208
208
 
209
+ // Tell the Transport parent class that we are about to destroy
210
+ // the class instance.
211
+ Destroying();
212
+
209
213
  this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
210
214
 
211
215
  delete this->udpSocket;
@@ -236,7 +236,7 @@ namespace RTC
236
236
  RTC::RtpStream::FillJsonStats(jsonObject);
237
237
 
238
238
  jsonObject["type"] = "inbound-rtp";
239
- jsonObject["jitter"] = this->jitter;
239
+ jsonObject["jitter"] = static_cast<uint32_t>(this->jitter);
240
240
  jsonObject["packetCount"] = this->transmissionCounter.GetPacketCount();
241
241
  jsonObject["byteCount"] = this->transmissionCounter.GetBytes();
242
242
  jsonObject["bitrate"] = this->transmissionCounter.GetBitrate(nowMs);
@@ -692,15 +692,14 @@ namespace RTC
692
692
  {
693
693
  MS_TRACE();
694
694
 
695
- if (this->params.clockRate == 0u)
695
+ if (GetClockRate() == 0u)
696
696
  {
697
697
  return;
698
698
  }
699
699
 
700
700
  // NOTE: Based on https://github.com/versatica/mediasoup/issues/1018.
701
- auto transit = static_cast<int>(
702
- DepLibUV::GetTimeMs() - (static_cast<uint64_t>(rtpTimestamp) * 1000 / this->params.clockRate));
703
- int d = transit - this->transit;
701
+ auto transit = static_cast<int>((DepLibUV::GetTimeMs() * GetClockRate() / 1000) - rtpTimestamp);
702
+ int d = transit - this->transit;
704
703
 
705
704
  // First transit calculation, save and return.
706
705
  if (this->transit == 0)
@@ -717,7 +716,7 @@ namespace RTC
717
716
  d = -d;
718
717
  }
719
718
 
720
- this->jitter += (1. / 16.) * (static_cast<double>(d) - this->jitter);
719
+ this->jitter += (1. / 16.) * (static_cast<float>(d) - this->jitter);
721
720
  }
722
721
 
723
722
  void RtpStreamRecv::UpdateScore()
@@ -182,9 +182,6 @@ namespace RTC
182
182
  {
183
183
  MS_TRACE();
184
184
 
185
- // Set the destroying flag.
186
- this->destroying = true;
187
-
188
185
  // The destructor must delete and clear everything silently.
189
186
 
190
187
  // Delete all Producers.
@@ -1594,6 +1591,13 @@ namespace RTC
1594
1591
  }
1595
1592
  }
1596
1593
 
1594
+ void Transport::Destroying()
1595
+ {
1596
+ MS_TRACE();
1597
+
1598
+ this->destroying = true;
1599
+ }
1600
+
1597
1601
  void Transport::Connected()
1598
1602
  {
1599
1603
  MS_TRACE();
@@ -300,6 +300,11 @@ namespace RTC
300
300
  {
301
301
  MS_TRACE();
302
302
 
303
+ // We need to tell the Transport parent class that we are about to destroy
304
+ // the class instance. This is because child's destructor runs before
305
+ // parent's destructor. See comment in Transport::OnSctpAssociationSendData().
306
+ Destroying();
307
+
303
308
  this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
304
309
 
305
310
  // Must delete the DTLS transport first since it will generate a DTLS alert
@@ -19,9 +19,7 @@
19
19
  #include <uv.h>
20
20
  #include <absl/container/flat_hash_map.h>
21
21
  #include <cerrno>
22
- #include <csignal> // sigaction()
23
- #include <cstdlib> // std::_Exit(), std::genenv()
24
- #include <iostream> // std::cerr, std::endl
22
+ #include <csignal> // sigaction()
25
23
  #include <string>
26
24
 
27
25
  void IgnoreSignals();
@@ -225,7 +223,9 @@ void IgnoreSignals()
225
223
  err = sigfillset(&act.sa_mask);
226
224
 
227
225
  if (err != 0)
226
+ {
228
227
  MS_THROW_ERROR("sigfillset() failed: %s", std::strerror(errno));
228
+ }
229
229
 
230
230
  for (auto& kv : ignoredSignals)
231
231
  {
@@ -235,7 +235,9 @@ void IgnoreSignals()
235
235
  err = sigaction(sigId, &act, nullptr);
236
236
 
237
237
  if (err != 0)
238
+ {
238
239
  MS_THROW_ERROR("sigaction() failed for signal %s: %s", sigName.c_str(), std::strerror(errno));
240
+ }
239
241
  }
240
242
  #endif
241
243
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  #include "MediaSoupErrors.hpp"
5
5
  #include "lib.hpp"
6
- #include <cstdlib> // std::_Exit(), std::genenv()
6
+ #include <cstdlib> // std::_Exit()
7
7
  #include <string>
8
8
 
9
9
  static constexpr int ConsumerChannelFd{ 3 };