mediasoup 3.12.5 → 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.5',
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.5";
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.5';
14
+ exports.version = '3.12.6';
15
15
  /**
16
16
  * Expose parseScalabilityMode() function.
17
17
  */
@@ -1,21 +1,21 @@
1
- export type * from './Worker';
2
- export type * from './WebRtcServer';
3
- export type * from './Router';
4
- export type * from './Transport';
5
- export type * from './WebRtcTransport';
6
- export type * from './PlainTransport';
7
- export type * from './PipeTransport';
8
- export type * from './DirectTransport';
9
- export type * from './Producer';
10
- export type * from './Consumer';
11
- export type * from './DataProducer';
12
- export type * from './DataConsumer';
13
- export type * from './RtpObserver';
14
- export type * from './ActiveSpeakerObserver';
15
- export type * from './AudioLevelObserver';
16
- export type * from './RtpParameters';
17
- export type * from './SctpParameters';
18
- export type * from './SrtpParameters';
1
+ export * from './Worker';
2
+ export * from './WebRtcServer';
3
+ export * from './Router';
4
+ export * from './Transport';
5
+ export * from './WebRtcTransport';
6
+ export * from './PlainTransport';
7
+ export * from './PipeTransport';
8
+ export * from './DirectTransport';
9
+ export * from './Producer';
10
+ export * from './Consumer';
11
+ export * from './DataProducer';
12
+ export * from './DataConsumer';
13
+ export * from './RtpObserver';
14
+ export * from './ActiveSpeakerObserver';
15
+ export * from './AudioLevelObserver';
16
+ export * from './RtpParameters';
17
+ export * from './SctpParameters';
18
+ export * from './SrtpParameters';
19
19
  export * from './errors';
20
20
  export type { ScalabilityMode } from './scalabilityModes';
21
21
  export type AppData = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,kBAAkB,CAAC;AAEtC,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"}
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/node/lib/types.js CHANGED
@@ -14,5 +14,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- // We cannot export only the type of error classes because those are useless.
17
+ __exportStar(require("./Worker"), exports);
18
+ __exportStar(require("./WebRtcServer"), exports);
19
+ __exportStar(require("./Router"), exports);
20
+ __exportStar(require("./Transport"), exports);
21
+ __exportStar(require("./WebRtcTransport"), exports);
22
+ __exportStar(require("./PlainTransport"), exports);
23
+ __exportStar(require("./PipeTransport"), exports);
24
+ __exportStar(require("./DirectTransport"), exports);
25
+ __exportStar(require("./Producer"), exports);
26
+ __exportStar(require("./Consumer"), exports);
27
+ __exportStar(require("./DataProducer"), exports);
28
+ __exportStar(require("./DataConsumer"), exports);
29
+ __exportStar(require("./RtpObserver"), exports);
30
+ __exportStar(require("./ActiveSpeakerObserver"), exports);
31
+ __exportStar(require("./AudioLevelObserver"), exports);
32
+ __exportStar(require("./RtpParameters"), exports);
33
+ __exportStar(require("./SctpParameters"), exports);
34
+ __exportStar(require("./SrtpParameters"), exports);
18
35
  __exportStar(require("./errors"), exports);
package/npm-scripts.mjs CHANGED
@@ -204,11 +204,11 @@ async function run()
204
204
  catch (error)
205
205
  {
206
206
  logError(error.message);
207
+
207
208
  exitWithError();
208
209
  }
209
210
 
210
211
  checkRelease();
211
-
212
212
  executeCmd(`git commit -am '${PKG.version}'`);
213
213
  executeCmd(`git tag -a ${PKG.version} -m '${PKG.version}'`);
214
214
  executeCmd(`git push origin v${MAYOR_VERSION}`);
@@ -243,7 +243,6 @@ async function run()
243
243
  case 'release:upload-mac-arm-prebuilt-worker':
244
244
  {
245
245
  checkRelease();
246
-
247
246
  await prebuildWorker();
248
247
  await uploadMacArmPrebuiltWorker();
249
248
 
@@ -428,6 +427,7 @@ function installMsysMake()
428
427
  if (res.status !== 0)
429
428
  {
430
429
  logError('`installMsysMake() | cannot find Python executable');
430
+
431
431
  exitWithError();
432
432
  }
433
433
  }
@@ -685,6 +685,7 @@ function executeCmd(command, exitOnError = true)
685
685
  if (exitOnError)
686
686
  {
687
687
  logError(`executeCmd() failed, exiting: ${error}`);
688
+
688
689
  exitWithError();
689
690
  }
690
691
  else
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.12.5",
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",
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,
@@ -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 };