mediasoup 3.11.8 → 3.11.9

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.
Files changed (62) hide show
  1. package/node/lib/Worker.js +1 -1
  2. package/node/lib/index.d.ts +1 -1
  3. package/node/lib/index.js +1 -1
  4. package/node/lib/ortc.js +1 -1
  5. package/node/lib/tests/test-Consumer.js +1 -1
  6. package/node/lib/tests/test-ortc.js +1 -1
  7. package/package.json +19 -19
  8. package/worker/Makefile +1 -1
  9. package/worker/src/DepLibSRTP.cpp +1 -1
  10. package/worker/src/DepLibUV.cpp +2 -2
  11. package/worker/src/DepUsrSCTP.cpp +2 -2
  12. package/worker/src/RTC/Codecs/H264.cpp +17 -5
  13. package/worker/src/RTC/Codecs/H264_SVC.cpp +4 -4
  14. package/worker/src/RTC/Codecs/VP8.cpp +22 -0
  15. package/worker/src/RTC/Codecs/VP9.cpp +28 -3
  16. package/worker/src/RTC/Consumer.cpp +1 -1
  17. package/worker/src/RTC/DirectTransport.cpp +3 -3
  18. package/worker/src/RTC/PipeConsumer.cpp +3 -3
  19. package/worker/src/RTC/PortManager.cpp +3 -3
  20. package/worker/src/RTC/Producer.cpp +28 -28
  21. package/worker/src/RTC/RTCP/Bye.cpp +1 -1
  22. package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +2 -2
  23. package/worker/src/RTC/RTCP/FeedbackPsSli.cpp +2 -2
  24. package/worker/src/RTC/RTCP/FeedbackPsVbcm.cpp +2 -2
  25. package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +3 -3
  26. package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +3 -3
  27. package/worker/src/RTC/RTCP/Packet.cpp +1 -1
  28. package/worker/src/RTC/RTCP/ReceiverReport.cpp +1 -1
  29. package/worker/src/RTC/RTCP/Sdes.cpp +2 -2
  30. package/worker/src/RTC/RTCP/SenderReport.cpp +1 -1
  31. package/worker/src/RTC/RTCP/XR.cpp +1 -1
  32. package/worker/src/RTC/RTCP/XrDelaySinceLastRr.cpp +1 -1
  33. package/worker/src/RTC/RateCalculator.cpp +1 -1
  34. package/worker/src/RTC/Router.cpp +2 -2
  35. package/worker/src/RTC/RtpDictionaries/RtpParameters.cpp +20 -1
  36. package/worker/src/RTC/RtpListener.cpp +11 -11
  37. package/worker/src/RTC/RtpPacket.cpp +1 -1
  38. package/worker/src/RTC/RtpProbationGenerator.cpp +1 -1
  39. package/worker/src/RTC/RtpStreamRecv.cpp +11 -10
  40. package/worker/src/RTC/RtpStreamSend.cpp +4 -4
  41. package/worker/src/RTC/SctpAssociation.cpp +3 -3
  42. package/worker/src/RTC/SenderBandwidthEstimator.cpp +2 -2
  43. package/worker/src/RTC/SeqManager.cpp +3 -3
  44. package/worker/src/RTC/SimulcastConsumer.cpp +9 -8
  45. package/worker/src/RTC/StunPacket.cpp +6 -5
  46. package/worker/src/RTC/Transport.cpp +8 -8
  47. package/worker/src/RTC/TransportCongestionControlServer.cpp +2 -2
  48. package/worker/src/RTC/TrendCalculator.cpp +1 -1
  49. package/worker/src/RTC/WebRtcServer.cpp +2 -2
  50. package/worker/src/RTC/WebRtcTransport.cpp +4 -4
  51. package/worker/src/Settings.cpp +1 -1
  52. package/worker/src/Worker.cpp +5 -5
  53. package/worker/src/handles/SignalsHandler.cpp +1 -1
  54. package/worker/src/handles/TcpConnectionHandler.cpp +6 -6
  55. package/worker/src/handles/TcpServerHandler.cpp +1 -1
  56. package/worker/src/handles/Timer.cpp +5 -5
  57. package/worker/src/handles/UdpSocketHandler.cpp +2 -2
  58. package/worker/src/handles/UnixStreamSocket.cpp +4 -4
  59. package/worker/src/main.cpp +1 -1
  60. package/worker/subprojects/libsrtp2.wrap +5 -4
  61. package/worker/test/src/RTC/TestRtpPacket.cpp +1 -1
  62. package/worker/test/src/RTC/TestRtpStreamSend.cpp +21 -21
@@ -83,7 +83,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
83
83
  // options
84
84
  {
85
85
  env: {
86
- MEDIASOUP_VERSION: '3.11.8',
86
+ MEDIASOUP_VERSION: '3.11.9',
87
87
  // Let the worker process inherit all environment variables, useful
88
88
  // if a custom and not in the path GCC is used so the user can set
89
89
  // 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.11.8";
12
+ export declare const version = "3.11.9";
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.11.8';
14
+ exports.version = '3.11.9';
15
15
  /**
16
16
  * Expose parseScalabilityMode() function.
17
17
  */
package/node/lib/ortc.js CHANGED
@@ -726,7 +726,7 @@ function getConsumerRtpParameters(consumableParams, caps, pipe) {
726
726
  // If there is simulast, mangle spatial layers in scalabilityMode.
727
727
  if (consumableParams.encodings.length > 1) {
728
728
  const { temporalLayers } = (0, scalabilityModes_1.parse)(scalabilityMode);
729
- scalabilityMode = `S${consumableParams.encodings.length}T${temporalLayers}`;
729
+ scalabilityMode = `L${consumableParams.encodings.length}T${temporalLayers}`;
730
730
  }
731
731
  if (scalabilityMode)
732
732
  consumerEncoding.scalabilityMode = scalabilityMode;
@@ -591,7 +591,7 @@ test('consumer.dump() succeeds', async () => {
591
591
  rtx: {
592
592
  ssrc: videoConsumer.rtpParameters.encodings?.[0].rtx?.ssrc
593
593
  },
594
- scalabilityMode: 'S4T1'
594
+ scalabilityMode: 'L4T1'
595
595
  }
596
596
  ]);
597
597
  expect(Array.isArray(data.consumableRtpEncodings)).toBe(true);
@@ -388,7 +388,7 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
388
388
  expect(typeof consumerRtpParameters.encodings?.[0].ssrc).toBe('number');
389
389
  expect(typeof consumerRtpParameters.encodings?.[0].rtx).toBe('object');
390
390
  expect(typeof consumerRtpParameters.encodings?.[0].rtx?.ssrc).toBe('number');
391
- expect(consumerRtpParameters.encodings?.[0].scalabilityMode).toBe('S3T3');
391
+ expect(consumerRtpParameters.encodings?.[0].scalabilityMode).toBe('L3T3');
392
392
  expect(consumerRtpParameters.encodings?.[0].maxBitrate).toBe(333333);
393
393
  expect(consumerRtpParameters.headerExtensions).toEqual([
394
394
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.11.8",
3
+ "version": "3.11.9",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -20,23 +20,23 @@
20
20
  "main": "node/lib/index.js",
21
21
  "types": "node/lib/index.d.ts",
22
22
  "files": [
23
- "npm-scripts.js",
24
23
  "node/lib",
25
- "worker/Makefile",
26
- "worker/meson.build",
27
- "worker/meson_options.txt",
28
- "worker/src",
29
- "worker/include",
30
- "worker/test/src",
31
- "worker/test/include",
32
- "worker/fuzzer/src",
33
- "worker/fuzzer/include",
34
- "worker/subprojects/*.wrap",
35
24
  "worker/deps/libwebrtc",
25
+ "worker/fuzzer/include",
26
+ "worker/fuzzer/src",
27
+ "worker/include",
28
+ "worker/scripts/*.js",
29
+ "worker/scripts/*.json",
36
30
  "worker/scripts/*.py",
37
31
  "worker/scripts/*.sh",
38
- "worker/scripts/*.js",
39
- "worker/scripts/*.json"
32
+ "worker/src",
33
+ "worker/subprojects/*.wrap",
34
+ "worker/test/include",
35
+ "worker/test/src",
36
+ "worker/Makefile",
37
+ "worker/meson.build",
38
+ "worker/meson_options.txt",
39
+ "npm-scripts.js"
40
40
  ],
41
41
  "keywords": [
42
42
  "webrtc",
@@ -93,13 +93,13 @@
93
93
  "devDependencies": {
94
94
  "@types/debug": "^4.1.7",
95
95
  "@types/jest": "^29.4.0",
96
- "@types/node": "^18.11.18",
96
+ "@types/node": "^18.13.0",
97
97
  "@types/uuid": "^9.0.0",
98
- "@typescript-eslint/eslint-plugin": "^5.50.0",
99
- "@typescript-eslint/parser": "^5.50.0",
100
- "eslint": "^8.33.0",
98
+ "@typescript-eslint/eslint-plugin": "^5.52.0",
99
+ "@typescript-eslint/parser": "^5.52.0",
100
+ "eslint": "^8.34.0",
101
101
  "eslint-plugin-jest": "^27.2.1",
102
- "jest": "^29.4.1",
102
+ "jest": "^29.4.3",
103
103
  "open-cli": "^7.1.0",
104
104
  "pick-port": "^1.0.1",
105
105
  "sctp": "^1.0.0",
package/worker/Makefile CHANGED
@@ -18,7 +18,7 @@ LCOV = ./deps/lcov/bin/lcov
18
18
  DOCKER ?= docker
19
19
  PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
20
20
  INSTALL_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
21
- BUILD_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/build
21
+ BUILD_DIR ?= $(INSTALL_DIR)/build
22
22
  MESON ?= $(PIP_DIR)/bin/meson
23
23
  MESON_VERSION ?= 0.61.5
24
24
  # `MESON_ARGS` can be used to provide extra configuration parameters to Meson,
@@ -56,7 +56,7 @@ void DepLibSRTP::ClassInit()
56
56
  {
57
57
  MS_DEBUG_TAG(info, "libsrtp version: \"%s\"", srtp_get_version_string());
58
58
 
59
- srtp_err_status_t err = srtp_init();
59
+ const srtp_err_status_t err = srtp_init();
60
60
 
61
61
  if (DepLibSRTP::IsError(err))
62
62
  MS_THROW_ERROR("srtp_init() failed: %s", DepLibSRTP::GetErrorString(err));
@@ -38,7 +38,7 @@ void DepLibUV::ClassInit()
38
38
 
39
39
  DepLibUV::loop = new uv_loop_t;
40
40
 
41
- int err = uv_loop_init(DepLibUV::loop);
41
+ const int err = uv_loop_init(DepLibUV::loop);
42
42
 
43
43
  if (err != 0)
44
44
  MS_ABORT("libuv loop initialization failed");
@@ -88,7 +88,7 @@ void DepLibUV::RunLoop()
88
88
  // This should never happen.
89
89
  MS_ASSERT(DepLibUV::loop != nullptr, "loop unset");
90
90
 
91
- int ret = uv_run(DepLibUV::loop, UV_RUN_DEFAULT);
91
+ const int ret = uv_run(DepLibUV::loop, UV_RUN_DEFAULT);
92
92
 
93
93
  MS_ASSERT(ret == 0, "uv_run() returned %s", uv_err_name(ret));
94
94
  }
@@ -236,8 +236,8 @@ void DepUsrSCTP::Checker::OnTimer(Timer* /*timer*/)
236
236
  {
237
237
  MS_TRACE();
238
238
 
239
- auto nowMs = DepLibUV::GetTimeMs();
240
- int elapsedMs = this->lastCalledAtMs ? static_cast<int>(nowMs - this->lastCalledAtMs) : 0;
239
+ auto nowMs = DepLibUV::GetTimeMs();
240
+ const int elapsedMs = this->lastCalledAtMs ? static_cast<int>(nowMs - this->lastCalledAtMs) : 0;
241
241
 
242
242
  usrsctp_handle_timers(elapsedMs);
243
243
 
@@ -17,7 +17,9 @@ namespace RTC
17
17
  MS_TRACE();
18
18
 
19
19
  if (len < 2)
20
+ {
20
21
  return nullptr;
22
+ }
21
23
 
22
24
  std::unique_ptr<PayloadDescriptor> payloadDescriptor(new PayloadDescriptor());
23
25
 
@@ -48,7 +50,9 @@ namespace RTC
48
50
 
49
51
  // Detect key frame.
50
52
  if (frameMarking->start && frameMarking->independent)
53
+ {
51
54
  payloadDescriptor->isKeyFrame = true;
55
+ }
52
56
  }
53
57
 
54
58
  // NOTE: Unfortunately libwebrtc produces wrong Frame-Marking (without i=1 in
@@ -59,7 +63,7 @@ namespace RTC
59
63
  // there is no frame-marking or if there is but keyframe was not detected above.
60
64
  if (!frameMarking || !payloadDescriptor->isKeyFrame)
61
65
  {
62
- uint8_t nal = *data & 0x1F;
66
+ const uint8_t nal = *data & 0x1F;
63
67
 
64
68
  switch (nal)
65
69
  {
@@ -83,8 +87,8 @@ namespace RTC
83
87
  // Iterate NAL units.
84
88
  while (len >= 3)
85
89
  {
86
- auto naluSize = Utils::Byte::Get2Bytes(data, offset);
87
- uint8_t subnal = *(data + offset + sizeof(naluSize)) & 0x1F;
90
+ auto naluSize = Utils::Byte::Get2Bytes(data, offset);
91
+ const uint8_t subnal = *(data + offset + sizeof(naluSize)) & 0x1F;
88
92
 
89
93
  if (subnal == 7)
90
94
  {
@@ -95,7 +99,9 @@ namespace RTC
95
99
 
96
100
  // Check if there is room for the indicated NAL unit size.
97
101
  if (len < (naluSize + sizeof(naluSize)))
102
+ {
98
103
  break;
104
+ }
99
105
 
100
106
  offset += naluSize + sizeof(naluSize);
101
107
  len -= naluSize + sizeof(naluSize);
@@ -109,11 +115,13 @@ namespace RTC
109
115
  case 28:
110
116
  case 29:
111
117
  {
112
- uint8_t subnal = *(data + 1) & 0x1F;
113
- uint8_t startBit = *(data + 1) & 0x80;
118
+ const uint8_t subnal = *(data + 1) & 0x1F;
119
+ const uint8_t startBit = *(data + 1) & 0x80;
114
120
 
115
121
  if (subnal == 7 && startBit == 128)
122
+ {
116
123
  payloadDescriptor->isKeyFrame = true;
124
+ }
117
125
 
118
126
  break;
119
127
  }
@@ -138,7 +146,9 @@ namespace RTC
138
146
  PayloadDescriptor* payloadDescriptor = H264::Parse(data, len, frameMarking, frameMarkingLen);
139
147
 
140
148
  if (!payloadDescriptor)
149
+ {
141
150
  return;
151
+ }
142
152
 
143
153
  auto* payloadDescriptorHandler = new PayloadDescriptorHandler(payloadDescriptor);
144
154
 
@@ -231,7 +241,9 @@ namespace RTC
231
241
  }
232
242
 
233
243
  if (context->GetCurrentTemporalLayer() > context->GetTargetTemporalLayer())
244
+ {
234
245
  context->SetCurrentTemporalLayer(context->GetTargetTemporalLayer());
246
+ }
235
247
 
236
248
  return true;
237
249
  }
@@ -58,7 +58,7 @@ namespace RTC
58
58
  // there is no frame-marking or if there is but keyframe was not detected above.
59
59
  if (!frameMarking || !payloadDescriptor->isKeyFrame)
60
60
  {
61
- uint8_t nal = *data & 0x1F;
61
+ const uint8_t nal = *data & 0x1F;
62
62
 
63
63
  switch (nal)
64
64
  {
@@ -121,7 +121,7 @@ namespace RTC
121
121
  case 28:
122
122
  case 29:
123
123
  {
124
- uint8_t startBit = *(data + 1) & 0x80;
124
+ const uint8_t startBit = *(data + 1) & 0x80;
125
125
 
126
126
  if (startBit == 128)
127
127
  {
@@ -145,7 +145,7 @@ namespace RTC
145
145
  std::unique_ptr<H264_SVC::PayloadDescriptor> payloadDescriptor,
146
146
  bool isStartBit)
147
147
  {
148
- uint8_t nal = *data & 0x1F;
148
+ const uint8_t nal = *data & 0x1F;
149
149
 
150
150
  switch (nal)
151
151
  {
@@ -286,7 +286,7 @@ namespace RTC
286
286
  }
287
287
 
288
288
  // clang-format off
289
- bool isOldPacket = false;
289
+ const bool isOldPacket = false;
290
290
 
291
291
  // Upgrade current spatial layer if needed.
292
292
  if (context->GetTargetSpatialLayer() > context->GetCurrentSpatialLayer())
@@ -20,7 +20,9 @@ namespace RTC
20
20
  MS_TRACE();
21
21
 
22
22
  if (len < 1)
23
+ {
23
24
  return nullptr;
25
+ }
24
26
 
25
27
  std::unique_ptr<PayloadDescriptor> payloadDescriptor(new PayloadDescriptor());
26
28
 
@@ -39,7 +41,9 @@ namespace RTC
39
41
  else
40
42
  {
41
43
  if (len < ++offset + 1)
44
+ {
42
45
  return nullptr;
46
+ }
43
47
 
44
48
  byte = data[offset];
45
49
 
@@ -52,14 +56,18 @@ namespace RTC
52
56
  if (payloadDescriptor->i)
53
57
  {
54
58
  if (len < ++offset + 1)
59
+ {
55
60
  return nullptr;
61
+ }
56
62
 
57
63
  byte = data[offset];
58
64
 
59
65
  if ((byte >> 7) & 0x01)
60
66
  {
61
67
  if (len < ++offset + 1)
68
+ {
62
69
  return nullptr;
70
+ }
63
71
 
64
72
  payloadDescriptor->hasTwoBytesPictureId = true;
65
73
  payloadDescriptor->pictureId = (byte & 0x7F) << 8;
@@ -77,7 +85,9 @@ namespace RTC
77
85
  if (payloadDescriptor->l)
78
86
  {
79
87
  if (len < ++offset + 1)
88
+ {
80
89
  return nullptr;
90
+ }
81
91
 
82
92
  payloadDescriptor->hasTl0PictureIndex = true;
83
93
  payloadDescriptor->tl0PictureIndex = data[offset];
@@ -86,7 +96,9 @@ namespace RTC
86
96
  if (payloadDescriptor->t || payloadDescriptor->k)
87
97
  {
88
98
  if (len < ++offset + 1)
99
+ {
89
100
  return nullptr;
101
+ }
90
102
 
91
103
  byte = data[offset];
92
104
 
@@ -126,7 +138,9 @@ namespace RTC
126
138
  PayloadDescriptor* payloadDescriptor = VP8::Parse(data, len, frameMarking, frameMarkingLen);
127
139
 
128
140
  if (!payloadDescriptor)
141
+ {
129
142
  return;
143
+ }
130
144
 
131
145
  auto* payloadDescriptorHandler = new PayloadDescriptorHandler(payloadDescriptor);
132
146
 
@@ -180,7 +194,9 @@ namespace RTC
180
194
 
181
195
  // Nothing to do.
182
196
  if (!this->extended)
197
+ {
183
198
  return;
199
+ }
184
200
 
185
201
  data += 2;
186
202
 
@@ -200,12 +216,16 @@ namespace RTC
200
216
  data++;
201
217
 
202
218
  if (pictureId > 127)
219
+ {
203
220
  MS_DEBUG_TAG(rtp, "casting pictureId value to one byte");
221
+ }
204
222
  }
205
223
  }
206
224
 
207
225
  if (this->l)
226
+ {
208
227
  *data = tl0PictureIndex;
228
+ }
209
229
  }
210
230
 
211
231
  void VP8::PayloadDescriptor::Restore(uint8_t* data) const
@@ -337,7 +357,9 @@ namespace RTC
337
357
  }
338
358
 
339
359
  if (context->GetCurrentTemporalLayer() > context->GetTargetTemporalLayer())
360
+ {
340
361
  context->SetCurrentTemporalLayer(context->GetTargetTemporalLayer());
362
+ }
341
363
 
342
364
  // clang-format off
343
365
  if (
@@ -19,7 +19,9 @@ namespace RTC
19
19
  MS_TRACE();
20
20
 
21
21
  if (len < 1)
22
+ {
22
23
  return nullptr;
24
+ }
23
25
 
24
26
  std::unique_ptr<PayloadDescriptor> payloadDescriptor(new PayloadDescriptor());
25
27
 
@@ -37,14 +39,18 @@ namespace RTC
37
39
  if (payloadDescriptor->i)
38
40
  {
39
41
  if (len < ++offset + 1)
42
+ {
40
43
  return nullptr;
44
+ }
41
45
 
42
46
  byte = data[offset];
43
47
 
44
48
  if (byte >> 7 & 0x01)
45
49
  {
46
50
  if (len < ++offset + 1)
51
+ {
47
52
  return nullptr;
53
+ }
48
54
 
49
55
  payloadDescriptor->pictureId = (byte & 0x7F) << 8;
50
56
  payloadDescriptor->pictureId += data[offset];
@@ -62,7 +68,9 @@ namespace RTC
62
68
  if (payloadDescriptor->l)
63
69
  {
64
70
  if (len < ++offset + 1)
71
+ {
65
72
  return nullptr;
73
+ }
66
74
 
67
75
  byte = data[offset];
68
76
 
@@ -74,7 +82,9 @@ namespace RTC
74
82
  payloadDescriptor->hasTlIndex = true;
75
83
 
76
84
  if (len < ++offset + 1)
85
+ {
77
86
  return nullptr;
87
+ }
78
88
 
79
89
  // Read TL0PICIDX if flexible mode is unset.
80
90
  if (!payloadDescriptor->f)
@@ -113,7 +123,9 @@ namespace RTC
113
123
  PayloadDescriptor* payloadDescriptor = VP9::Parse(data, len, frameMarking, frameMarkingLen);
114
124
 
115
125
  if (!payloadDescriptor)
126
+ {
116
127
  return;
128
+ }
117
129
 
118
130
  if (payloadDescriptor->isKeyFrame)
119
131
  {
@@ -211,7 +223,7 @@ namespace RTC
211
223
  }
212
224
 
213
225
  // clang-format off
214
- bool isOldPacket = (
226
+ const bool isOldPacket = (
215
227
  this->payloadDescriptor->hasPictureId &&
216
228
  RTC::SeqManager<uint16_t, 15>::IsSeqLowerThan(
217
229
  this->payloadDescriptor->pictureId,
@@ -285,10 +297,15 @@ namespace RTC
285
297
  // * higher than current one
286
298
  // * different than the current one when KSVC is enabled and this is not a keyframe
287
299
  // (interframe p bit = 1)
300
+ // clang-format off
288
301
  if (
289
302
  !isOldPacket &&
290
- (packetSpatialLayer > tmpSpatialLayer ||
291
- (context->IsKSvc() && this->payloadDescriptor->p && packetSpatialLayer != tmpSpatialLayer)))
303
+ (
304
+ packetSpatialLayer > tmpSpatialLayer ||
305
+ (context->IsKSvc() && this->payloadDescriptor->p && packetSpatialLayer != tmpSpatialLayer)
306
+ )
307
+ )
308
+ // clang-format on
292
309
  {
293
310
  return false;
294
311
  }
@@ -345,12 +362,16 @@ namespace RTC
345
362
 
346
363
  // Filter temporal layers higher than current one.
347
364
  if (packetTemporalLayer > tmpTemporalLayer)
365
+ {
348
366
  return false;
367
+ }
349
368
  }
350
369
 
351
370
  // Set marker bit if needed.
352
371
  if (packetSpatialLayer == tmpSpatialLayer && this->payloadDescriptor->e)
372
+ {
353
373
  marker = true;
374
+ }
354
375
 
355
376
  // Update the pictureId manager.
356
377
  if (this->payloadDescriptor->hasPictureId)
@@ -362,11 +383,15 @@ namespace RTC
362
383
 
363
384
  // Update current spatial layer if needed.
364
385
  if (tmpSpatialLayer != context->GetCurrentSpatialLayer())
386
+ {
365
387
  context->SetCurrentSpatialLayer(tmpSpatialLayer);
388
+ }
366
389
 
367
390
  // Update current temporal layer if needed.
368
391
  if (tmpTemporalLayer != context->GetCurrentTemporalLayer())
392
+ {
369
393
  context->SetCurrentTemporalLayer(tmpTemporalLayer);
394
+ }
370
395
 
371
396
  return true;
372
397
  }
@@ -347,7 +347,7 @@ namespace RTC
347
347
  if (!type.is_string())
348
348
  MS_THROW_TYPE_ERROR("wrong type (not a string)");
349
349
 
350
- std::string typeStr = type.get<std::string>();
350
+ const std::string typeStr = type.get<std::string>();
351
351
 
352
352
  if (typeStr == "rtp")
353
353
  newTraceEventTypes.rtp = true;
@@ -122,7 +122,7 @@ namespace RTC
122
122
  }
123
123
 
124
124
  const uint8_t* data = packet->GetData();
125
- size_t len = packet->GetSize();
125
+ const size_t len = packet->GetSize();
126
126
 
127
127
  // Notify the Node DirectTransport.
128
128
  this->shared->payloadChannelNotifier->Emit(consumer->id, "rtp", data, len);
@@ -142,7 +142,7 @@ namespace RTC
142
142
  MS_TRACE();
143
143
 
144
144
  const uint8_t* data = packet->GetData();
145
- size_t len = packet->GetSize();
145
+ const size_t len = packet->GetSize();
146
146
 
147
147
  // Notify the Node DirectTransport.
148
148
  this->shared->payloadChannelNotifier->Emit(this->id, "rtcp", data, len);
@@ -158,7 +158,7 @@ namespace RTC
158
158
  packet->Serialize(RTC::RTCP::Buffer);
159
159
 
160
160
  const uint8_t* data = packet->GetData();
161
- size_t len = packet->GetSize();
161
+ const size_t len = packet->GetSize();
162
162
 
163
163
  // Notify the Node DirectTransport.
164
164
  this->shared->payloadChannelNotifier->Emit(this->id, "rtcp", data, len);
@@ -25,8 +25,8 @@ namespace RTC
25
25
  if (this->rtpParameters.encodings.size() != this->consumableRtpEncodings.size())
26
26
  MS_THROW_TYPE_ERROR("number of rtpParameters.encodings and consumableRtpEncodings do not match");
27
27
 
28
- auto& encoding = this->rtpParameters.encodings[0];
29
- auto* mediaCodec = this->rtpParameters.GetCodecForEncoding(encoding);
28
+ auto& encoding = this->rtpParameters.encodings[0];
29
+ const auto* mediaCodec = this->rtpParameters.GetCodecForEncoding(encoding);
30
30
 
31
31
  this->keyFrameSupported = RTC::Codecs::Tools::CanBeKeyFrame(mediaCodec->mimeType);
32
32
 
@@ -226,7 +226,7 @@ namespace RTC
226
226
  return;
227
227
 
228
228
  // Whether this is the first packet after re-sync.
229
- bool isSyncPacket = syncRequired;
229
+ const bool isSyncPacket = syncRequired;
230
230
 
231
231
  // Sync sequence number and timestamp if required.
232
232
  if (isSyncPacket)
@@ -39,13 +39,13 @@ namespace RTC
39
39
  Utils::IP::NormalizeIp(ip);
40
40
 
41
41
  int err;
42
- int family = Utils::IP::GetFamily(ip);
42
+ const int family = Utils::IP::GetFamily(ip);
43
43
  struct sockaddr_storage bindAddr; // NOLINT(cppcoreguidelines-pro-type-member-init)
44
44
  size_t portIdx;
45
45
  int flags{ 0 };
46
46
  std::vector<bool>& ports = PortManager::GetPorts(transport, ip);
47
47
  size_t attempt{ 0u };
48
- size_t numAttempts = ports.size();
48
+ const size_t numAttempts = ports.size();
49
49
  uv_handle_t* uvHandle{ nullptr };
50
50
  uint16_t port;
51
51
  std::string transportStr;
@@ -322,7 +322,7 @@ namespace RTC
322
322
  Utils::IP::NormalizeIp(ip);
323
323
 
324
324
  int err;
325
- int family = Utils::IP::GetFamily(ip);
325
+ const int family = Utils::IP::GetFamily(ip);
326
326
  struct sockaddr_storage bindAddr; // NOLINT(cppcoreguidelines-pro-type-member-init)
327
327
  int flags{ 0 };
328
328
  uv_handle_t* uvHandle{ nullptr };