mediasoup 3.9.7 → 3.9.8

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.
@@ -81,7 +81,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
81
81
  // options
82
82
  {
83
83
  env: {
84
- MEDIASOUP_VERSION: '3.9.7',
84
+ MEDIASOUP_VERSION: '3.9.8',
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.
@@ -9,7 +9,7 @@ export { types };
9
9
  /**
10
10
  * Expose mediasoup version.
11
11
  */
12
- export declare const version = "3.9.7";
12
+ export declare const version = "3.9.8";
13
13
  /**
14
14
  * Expose parseScalabilityMode() function.
15
15
  */
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.9.7';
14
+ exports.version = '3.9.8';
15
15
  /**
16
16
  * Expose parseScalabilityMode() function.
17
17
  */
package/node/lib/types.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,4 +1,3 @@
1
- declare const randomNumberGenerator: (min?: number | null | undefined, max?: number | null | undefined, integer?: boolean | null | undefined) => number;
2
1
  /**
3
2
  * Clones the given object/array.
4
3
  */
@@ -6,5 +5,5 @@ export declare function clone(data: any): any;
6
5
  /**
7
6
  * Generates a random positive integer.
8
7
  */
9
- export { randomNumberGenerator as generateRandomNumber };
8
+ export declare function generateRandomNumber(): number;
10
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,qBAAqB,oHAKxB,CAAC;AAEJ;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAMpC;AAED;;GAEG;AACH,OAAO,EAAE,qBAAqB,IAAI,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAMpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,WAGnC"}
package/node/lib/utils.js CHANGED
@@ -1,13 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateRandomNumber = exports.clone = void 0;
4
- const randomNumber = require("random-number");
5
- const randomNumberGenerator = randomNumber.generator({
6
- min: 100000000,
7
- max: 999999999,
8
- integer: true
9
- });
10
- exports.generateRandomNumber = randomNumberGenerator;
4
+ const crypto_1 = require("crypto");
11
5
  /**
12
6
  * Clones the given object/array.
13
7
  */
@@ -17,3 +11,10 @@ function clone(data) {
17
11
  return JSON.parse(JSON.stringify(data));
18
12
  }
19
13
  exports.clone = clone;
14
+ /**
15
+ * Generates a random positive integer.
16
+ */
17
+ function generateRandomNumber() {
18
+ return (0, crypto_1.randomInt)(100_000_000, 999_999_999);
19
+ }
20
+ exports.generateRandomNumber = generateRandomNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.9.7",
3
+ "version": "3.9.8",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -72,17 +72,15 @@
72
72
  "@types/node": "^16.11.10",
73
73
  "debug": "^4.3.3",
74
74
  "h264-profile-level-id": "^1.0.1",
75
- "random-number": "^0.0.9",
76
75
  "supports-color": "^9.2.1",
77
76
  "uuid": "^8.3.2"
78
77
  },
79
78
  "devDependencies": {
80
79
  "@types/debug": "^4.1.7",
81
- "@types/random-number": "^0.0.1",
82
80
  "@types/uuid": "^8.3.4",
83
- "@typescript-eslint/eslint-plugin": "^5.12.1",
84
- "@typescript-eslint/parser": "^5.12.1",
85
- "eslint": "^8.9.0",
81
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
82
+ "@typescript-eslint/parser": "^5.13.0",
83
+ "eslint": "^8.10.0",
86
84
  "eslint-plugin-jest": "^26.1.1",
87
85
  "jest": "^27.5.1",
88
86
  "jest-tobetype": "^1.2.3",
@@ -90,6 +88,6 @@
90
88
  "pick-port": "^1.0.0",
91
89
  "sctp": "^1.0.0",
92
90
  "tsc-watch": "^4.6.0",
93
- "typescript": "^4.5.5"
91
+ "typescript": "^4.6.2"
94
92
  }
95
93
  }
@@ -83,6 +83,7 @@ namespace RTC
83
83
  private:
84
84
  void MayEmitAvailableBitrateEvent(uint32_t previousAvailableBitrate);
85
85
  void UpdatePacketLoss(double packetLoss);
86
+ void ApplyBitrateUpdates();
86
87
 
87
88
  void InitializeController();
88
89
  void DestroyController();
@@ -281,9 +281,17 @@ namespace RTC
281
281
  }
282
282
  }
283
283
 
284
- // Filter spatial layers higher than current one (unless old packet).
285
- if (packetSpatialLayer > tmpSpatialLayer && !isOldPacket)
284
+ // Unless old packet filter spatial layers that are either
285
+ // * higher than current one
286
+ // * different than the current one when KSVC is enabled and this is not a keyframe
287
+ // (interframe p bit = 1)
288
+ if (
289
+ !isOldPacket &&
290
+ (packetSpatialLayer > tmpSpatialLayer ||
291
+ (context->IsKSvc() && this->payloadDescriptor->p && packetSpatialLayer != tmpSpatialLayer)))
292
+ {
286
293
  return false;
294
+ }
287
295
 
288
296
  // Check and handle temporal layer (unless old packet).
289
297
  if (!isOldPacket)
@@ -269,6 +269,14 @@ namespace RTC
269
269
  MS_THROW_ERROR("maxOutgoingBitrate must be >= 30000bps");
270
270
 
271
271
  this->maxOutgoingBitrate = maxBitrate;
272
+
273
+ ApplyBitrateUpdates();
274
+
275
+ if (this->maxOutgoingBitrate > 0u)
276
+ {
277
+ this->bitrates.availableBitrate =
278
+ std::min<uint32_t>(this->maxOutgoingBitrate, this->bitrates.availableBitrate);
279
+ }
272
280
  }
273
281
 
274
282
  void TransportCongestionControlClient::SetDesiredBitrate(uint32_t desiredBitrate, bool force)
@@ -290,6 +298,11 @@ namespace RTC
290
298
  // more stable values.
291
299
  this->bitrates.startBitrate = std::max<uint32_t>(MinBitrate, this->bitrates.availableBitrate);
292
300
 
301
+ ApplyBitrateUpdates();
302
+ }
303
+
304
+ void TransportCongestionControlClient::ApplyBitrateUpdates()
305
+ {
293
306
  auto currentMaxBitrate = this->bitrates.maxBitrate;
294
307
  uint32_t newMaxBitrate = 0;
295
308