mediasoup 3.12.5 → 3.12.7

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.7',
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.7";
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.7';
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.7",
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",
@@ -95,15 +95,15 @@
95
95
  "uuid": "^9.0.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@octokit/rest": "^19.0.13",
98
+ "@octokit/rest": "^20.0.1",
99
99
  "@types/debug": "^4.1.8",
100
- "@types/jest": "^29.5.2",
101
- "@types/node": "^18.16.18",
100
+ "@types/jest": "^29.5.3",
101
+ "@types/node": "^20.4.2",
102
102
  "@types/uuid": "^9.0.2",
103
- "@typescript-eslint/eslint-plugin": "^5.61.0",
104
- "@typescript-eslint/parser": "^5.61.0",
105
- "eslint": "^8.44.0",
106
- "eslint-plugin-jest": "^27.2.2",
103
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
104
+ "@typescript-eslint/parser": "^6.1.0",
105
+ "eslint": "^8.45.0",
106
+ "eslint-plugin-jest": "^27.2.3",
107
107
  "jest": "^29.6.1",
108
108
  "marked": "^5.1.1",
109
109
  "open-cli": "^7.2.0",
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 \
@@ -14,6 +14,7 @@
14
14
  #include "RTC/RtpHeaderExtensionIds.hpp"
15
15
  #include "RTC/RtpPacket.hpp"
16
16
  #include "RTC/RtpStream.hpp"
17
+ #include "RTC/RtpStreamRecv.hpp"
17
18
  #include "RTC/RtpStreamSend.hpp"
18
19
  #include "RTC/Shared.hpp"
19
20
  #include <absl/container/flat_hash_set.h>
@@ -129,12 +130,12 @@ namespace RTC
129
130
  }
130
131
  void ProducerPaused();
131
132
  void ProducerResumed();
132
- virtual void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
133
- virtual void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
133
+ virtual void ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) = 0;
134
+ virtual void ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) = 0;
134
135
  void ProducerRtpStreamScores(const std::vector<uint8_t>* scores);
135
136
  virtual void ProducerRtpStreamScore(
136
- RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
137
- virtual void ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first) = 0;
137
+ RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) = 0;
138
+ virtual void ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first) = 0;
138
139
  void ProducerClosed();
139
140
  void SetExternallyManagedBitrate()
140
141
  {
@@ -2,7 +2,6 @@
2
2
  #define MS_RTC_PIPE_CONSUMER_HPP
3
3
 
4
4
  #include "RTC/Consumer.hpp"
5
- #include "RTC/RtpStreamSend.hpp"
6
5
  #include "RTC/SeqManager.hpp"
7
6
  #include "RTC/Shared.hpp"
8
7
 
@@ -23,10 +22,11 @@ namespace RTC
23
22
  void FillJson(json& jsonObject) const override;
24
23
  void FillJsonStats(json& jsonArray) const override;
25
24
  void FillJsonScore(json& jsonObject) const override;
26
- void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
27
- void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
28
- void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
29
- void ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first) override;
25
+ void ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
26
+ void ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
27
+ void ProducerRtpStreamScore(
28
+ RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) override;
29
+ void ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first) override;
30
30
  uint8_t GetBitratePriority() const override;
31
31
  uint32_t IncreaseLayer(uint32_t bitrate, bool considerLoss) override;
32
32
  void ApplyLayers() override;
@@ -40,11 +40,14 @@ namespace RTC
40
40
  virtual void OnProducerPaused(RTC::Producer* producer) = 0;
41
41
  virtual void OnProducerResumed(RTC::Producer* producer) = 0;
42
42
  virtual void OnProducerNewRtpStream(
43
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc) = 0;
43
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) = 0;
44
44
  virtual void OnProducerRtpStreamScore(
45
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) = 0;
45
+ RTC::Producer* producer,
46
+ RTC::RtpStreamRecv* rtpStream,
47
+ uint8_t score,
48
+ uint8_t previousScore) = 0;
46
49
  virtual void OnProducerRtcpSenderReport(
47
- RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first) = 0;
50
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, bool first) = 0;
48
51
  virtual void OnProducerRtpPacketReceived(RTC::Producer* producer, RTC::RtpPacket* packet) = 0;
49
52
  virtual void OnProducerSendRtcpPacket(RTC::Producer* producer, RTC::RTCP::Packet* packet) = 0;
50
53
  virtual void OnProducerNeedWorstRemoteFractionLost(
@@ -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
  {
@@ -11,7 +11,7 @@
11
11
  #include "RTC/Producer.hpp"
12
12
  #include "RTC/RtpObserver.hpp"
13
13
  #include "RTC/RtpPacket.hpp"
14
- #include "RTC/RtpStream.hpp"
14
+ #include "RTC/RtpStreamRecv.hpp"
15
15
  #include "RTC/Shared.hpp"
16
16
  #include "RTC/Transport.hpp"
17
17
  #include "RTC/WebRtcServer.hpp"
@@ -65,16 +65,19 @@ namespace RTC
65
65
  void OnTransportProducerNewRtpStream(
66
66
  RTC::Transport* transport,
67
67
  RTC::Producer* producer,
68
- RTC::RtpStream* rtpStream,
68
+ RTC::RtpStreamRecv* rtpStream,
69
69
  uint32_t mappedSsrc) override;
70
70
  void OnTransportProducerRtpStreamScore(
71
71
  RTC::Transport* transport,
72
72
  RTC::Producer* producer,
73
- RTC::RtpStream* rtpStream,
73
+ RTC::RtpStreamRecv* rtpStream,
74
74
  uint8_t score,
75
75
  uint8_t previousScore) override;
76
76
  void OnTransportProducerRtcpSenderReport(
77
- RTC::Transport* transport, RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first) override;
77
+ RTC::Transport* transport,
78
+ RTC::Producer* producer,
79
+ RTC::RtpStreamRecv* rtpStream,
80
+ bool first) override;
78
81
  void OnTransportProducerRtpPacketReceived(
79
82
  RTC::Transport* transport, RTC::Producer* producer, RTC::RtpPacket* packet) override;
80
83
  void OnTransportNeedWorstRemoteFractionLost(
@@ -76,6 +76,10 @@ namespace RTC
76
76
  {
77
77
  return this->transmissionCounter.GetLayerBitrate(nowMs, spatialLayer, temporalLayer);
78
78
  }
79
+ bool HasRtpInactivityCheckEnabled() const
80
+ {
81
+ return this->useRtpInactivityCheck;
82
+ }
79
83
 
80
84
  private:
81
85
  void CalculateJitter(uint32_t rtpTimestamp);
@@ -114,7 +118,9 @@ namespace RTC
114
118
  uint64_t lastSrReceived{ 0u };
115
119
  // Relative transit time for prev packet.
116
120
  int32_t transit{ 0u };
117
- uint32_t jitter{ 0u };
121
+ // Jitter in RTP timestamp units. As per spec it's kept as floating value
122
+ // although it's exposed as integer in the stats.
123
+ float jitter{ 0 };
118
124
  uint8_t firSeqNumber{ 0u };
119
125
  uint32_t reportedPacketLost{ 0u };
120
126
  std::unique_ptr<RTC::NackGenerator> nackGenerator;
@@ -2,7 +2,6 @@
2
2
  #define MS_RTC_SIMPLE_CONSUMER_HPP
3
3
 
4
4
  #include "RTC/Consumer.hpp"
5
- #include "RTC/RtpStreamSend.hpp"
6
5
  #include "RTC/SeqManager.hpp"
7
6
  #include "RTC/Shared.hpp"
8
7
 
@@ -29,14 +28,17 @@ namespace RTC
29
28
  return (
30
29
  RTC::Consumer::IsActive() &&
31
30
  this->producerRtpStream &&
32
- (this->producerRtpStream->GetScore() > 0u || this->producerRtpStream->HasDtx())
31
+ // If there is no RTP inactivity check do not consider the stream
32
+ // inactive despite it has score 0.
33
+ (this->producerRtpStream->GetScore() > 0u || !this->producerRtpStream->HasRtpInactivityCheckEnabled())
33
34
  );
34
35
  // clang-format on
35
36
  }
36
- void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
37
- void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
38
- void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
39
- void ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first) override;
37
+ void ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
38
+ void ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
39
+ void ProducerRtpStreamScore(
40
+ RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) override;
41
+ void ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first) override;
40
42
  uint8_t GetBitratePriority() const override;
41
43
  uint32_t IncreaseLayer(uint32_t bitrate, bool considerLoss) override;
42
44
  void ApplyLayers() override;
@@ -78,7 +80,7 @@ namespace RTC
78
80
  RTC::RtpStreamSend* rtpStream{ nullptr };
79
81
  // Others.
80
82
  std::vector<RTC::RtpStreamSend*> rtpStreams;
81
- RTC::RtpStream* producerRtpStream{ nullptr };
83
+ RTC::RtpStreamRecv* producerRtpStream{ nullptr };
82
84
  bool keyFrameSupported{ false };
83
85
  bool syncRequired{ false };
84
86
  RTC::SeqManager<uint16_t> rtpSeqManager;
@@ -3,7 +3,6 @@
3
3
 
4
4
  #include "RTC/Codecs/PayloadDescriptorHandler.hpp"
5
5
  #include "RTC/Consumer.hpp"
6
- #include "RTC/RtpStreamSend.hpp"
7
6
  #include "RTC/SeqManager.hpp"
8
7
  #include "RTC/Shared.hpp"
9
8
 
@@ -41,18 +40,21 @@ namespace RTC
41
40
  std::any_of(
42
41
  this->producerRtpStreams.begin(),
43
42
  this->producerRtpStreams.end(),
44
- [](const RTC::RtpStream* rtpStream)
43
+ [](const RTC::RtpStreamRecv* rtpStream)
45
44
  {
46
- return (rtpStream != nullptr && (rtpStream->GetScore() > 0u || rtpStream->HasDtx()));
45
+ // If there is no RTP inactivity check do not consider the stream
46
+ // inactive despite it has score 0.
47
+ return (rtpStream != nullptr && (rtpStream->GetScore() > 0u || !rtpStream->HasRtpInactivityCheckEnabled()));
47
48
  }
48
49
  )
49
50
  );
50
51
  // clang-format on
51
52
  }
52
- void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
53
- void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
54
- void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
55
- void ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first) override;
53
+ void ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
54
+ void ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
55
+ void ProducerRtpStreamScore(
56
+ RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) override;
57
+ void ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first) override;
56
58
  uint8_t GetBitratePriority() const override;
57
59
  uint32_t IncreaseLayer(uint32_t bitrate, bool considerLoss) override;
58
60
  void ApplyLayers() override;
@@ -90,9 +92,9 @@ namespace RTC
90
92
  bool CanSwitchToSpatialLayer(int16_t spatialLayer) const;
91
93
  void EmitScore() const;
92
94
  void EmitLayersChange() const;
93
- RTC::RtpStream* GetProducerCurrentRtpStream() const;
94
- RTC::RtpStream* GetProducerTargetRtpStream() const;
95
- RTC::RtpStream* GetProducerTsReferenceRtpStream() const;
95
+ RTC::RtpStreamRecv* GetProducerCurrentRtpStream() const;
96
+ RTC::RtpStreamRecv* GetProducerTargetRtpStream() const;
97
+ RTC::RtpStreamRecv* GetProducerTsReferenceRtpStream() const;
96
98
 
97
99
  /* Pure virtual methods inherited from RtpStreamSend::Listener. */
98
100
  public:
@@ -105,7 +107,7 @@ namespace RTC
105
107
  // Others.
106
108
  absl::flat_hash_map<uint32_t, int16_t> mapMappedSsrcSpatialLayer;
107
109
  std::vector<RTC::RtpStreamSend*> rtpStreams;
108
- std::vector<RTC::RtpStream*> producerRtpStreams; // Indexed by spatial layer.
110
+ std::vector<RTC::RtpStreamRecv*> producerRtpStreams; // Indexed by spatial layer.
109
111
  bool syncRequired{ false };
110
112
  int16_t spatialLayerToSync{ -1 };
111
113
  bool lastSentPacketHasMarker{ false };
@@ -3,7 +3,6 @@
3
3
 
4
4
  #include "RTC/Codecs/PayloadDescriptorHandler.hpp"
5
5
  #include "RTC/Consumer.hpp"
6
- #include "RTC/RtpStreamSend.hpp"
7
6
  #include "RTC/SeqManager.hpp"
8
7
  #include "RTC/Shared.hpp"
9
8
  #include <map>
@@ -40,14 +39,17 @@ namespace RTC
40
39
  return (
41
40
  RTC::Consumer::IsActive() &&
42
41
  this->producerRtpStream &&
43
- (this->producerRtpStream->GetScore() > 0u || this->producerRtpStream->HasDtx())
42
+ // If there is no RTP inactivity check do not consider the stream
43
+ // inactive despite it has score 0.
44
+ (this->producerRtpStream->GetScore() > 0u || !this->producerRtpStream->HasRtpInactivityCheckEnabled())
44
45
  );
45
46
  // clang-format on
46
47
  }
47
- void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
48
- void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
49
- void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
50
- void ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first) override;
48
+ void ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
49
+ void ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
50
+ void ProducerRtpStreamScore(
51
+ RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore) override;
52
+ void ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first) override;
51
53
  uint8_t GetBitratePriority() const override;
52
54
  uint32_t IncreaseLayer(uint32_t bitrate, bool considerLoss) override;
53
55
  void ApplyLayers() override;
@@ -93,7 +95,7 @@ namespace RTC
93
95
  RTC::RtpStreamSend* rtpStream{ nullptr };
94
96
  // Others.
95
97
  std::vector<RTC::RtpStreamSend*> rtpStreams;
96
- RTC::RtpStream* producerRtpStream{ nullptr };
98
+ RTC::RtpStreamRecv* producerRtpStream{ nullptr };
97
99
  bool syncRequired{ false };
98
100
  RTC::SeqManager<uint16_t> rtpSeqManager;
99
101
  int16_t preferredSpatialLayer{ -1 };
@@ -69,16 +69,19 @@ namespace RTC
69
69
  virtual void OnTransportProducerNewRtpStream(
70
70
  RTC::Transport* transport,
71
71
  RTC::Producer* producer,
72
- RTC::RtpStream* rtpStream,
72
+ RTC::RtpStreamRecv* rtpStream,
73
73
  uint32_t mappedSsrc) = 0;
74
74
  virtual void OnTransportProducerRtpStreamScore(
75
75
  RTC::Transport* transport,
76
76
  RTC::Producer* producer,
77
- RTC::RtpStream* rtpStream,
77
+ RTC::RtpStreamRecv* rtpStream,
78
78
  uint8_t score,
79
79
  uint8_t previousScore) = 0;
80
80
  virtual void OnTransportProducerRtcpSenderReport(
81
- RTC::Transport* transport, RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first) = 0;
81
+ RTC::Transport* transport,
82
+ RTC::Producer* producer,
83
+ RTC::RtpStreamRecv* rtpStream,
84
+ bool first) = 0;
82
85
  virtual void OnTransportProducerRtpPacketReceived(
83
86
  RTC::Transport* transport, RTC::Producer* producer, RTC::RtpPacket* packet) = 0;
84
87
  virtual void OnTransportNeedWorstRemoteFractionLost(
@@ -144,6 +147,7 @@ namespace RTC
144
147
 
145
148
  protected:
146
149
  // Must be called from the subclass.
150
+ void Destroying();
147
151
  void Connected();
148
152
  void Disconnected();
149
153
  void DataReceived(size_t len)
@@ -203,11 +207,14 @@ namespace RTC
203
207
  void OnProducerPaused(RTC::Producer* producer) override;
204
208
  void OnProducerResumed(RTC::Producer* producer) override;
205
209
  void OnProducerNewRtpStream(
206
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
210
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc) override;
207
211
  void OnProducerRtpStreamScore(
208
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
212
+ RTC::Producer* producer,
213
+ RTC::RtpStreamRecv* rtpStream,
214
+ uint8_t score,
215
+ uint8_t previousScore) override;
209
216
  void OnProducerRtcpSenderReport(
210
- RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first) override;
217
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, bool first) override;
211
218
  void OnProducerRtpPacketReceived(RTC::Producer* producer, RTC::RtpPacket* packet) override;
212
219
  void OnProducerSendRtcpPacket(RTC::Producer* producer, RTC::RTCP::Packet* packet) override;
213
220
  void OnProducerNeedWorstRemoteFractionLost(
@@ -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
 
@@ -137,14 +137,14 @@ namespace RTC
137
137
  }
138
138
  }
139
139
 
140
- void PipeConsumer::ProducerRtpStream(RTC::RtpStream* /*rtpStream*/, uint32_t /*mappedSsrc*/)
140
+ void PipeConsumer::ProducerRtpStream(RTC::RtpStreamRecv* /*rtpStream*/, uint32_t /*mappedSsrc*/)
141
141
  {
142
142
  MS_TRACE();
143
143
 
144
144
  // Do nothing.
145
145
  }
146
146
 
147
- void PipeConsumer::ProducerNewRtpStream(RTC::RtpStream* /*rtpStream*/, uint32_t /*mappedSsrc*/)
147
+ void PipeConsumer::ProducerNewRtpStream(RTC::RtpStreamRecv* /*rtpStream*/, uint32_t /*mappedSsrc*/)
148
148
  {
149
149
  MS_TRACE();
150
150
 
@@ -152,14 +152,14 @@ namespace RTC
152
152
  }
153
153
 
154
154
  void PipeConsumer::ProducerRtpStreamScore(
155
- RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
155
+ RTC::RtpStreamRecv* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
156
156
  {
157
157
  MS_TRACE();
158
158
 
159
159
  // Do nothing.
160
160
  }
161
161
 
162
- void PipeConsumer::ProducerRtcpSenderReport(RTC::RtpStream* /*rtpStream*/, bool /*first*/)
162
+ void PipeConsumer::ProducerRtcpSenderReport(RTC::RtpStreamRecv* /*rtpStream*/, bool /*first*/)
163
163
  {
164
164
  MS_TRACE();
165
165
 
@@ -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;
@@ -1223,8 +1223,10 @@ namespace RTC
1223
1223
  }
1224
1224
  }
1225
1225
 
1226
- // Only perform RTP inactivity check on simulcast.
1227
- auto useRtpInactivityCheck = this->type == RtpParameters::Type::SIMULCAST;
1226
+ // Only perform RTP inactivity check on simulcast and only if there are
1227
+ // more than 1 stream.
1228
+ auto useRtpInactivityCheck =
1229
+ this->type == RtpParameters::Type::SIMULCAST && this->rtpMapping.encodings.size() > 1;
1228
1230
 
1229
1231
  // Create a RtpStreamRecv for receiving a media stream.
1230
1232
  auto* rtpStream = new RTC::RtpStreamRecv(this, params, SendNackDelay, useRtpInactivityCheck);
@@ -1255,7 +1257,7 @@ namespace RTC
1255
1257
  auto mappedSsrc = this->mapRtpStreamMappedSsrc.at(rtpStream);
1256
1258
 
1257
1259
  // Notify the listener.
1258
- this->listener->OnProducerNewRtpStream(this, static_cast<RTC::RtpStream*>(rtpStream), mappedSsrc);
1260
+ this->listener->OnProducerNewRtpStream(this, rtpStream, mappedSsrc);
1259
1261
  }
1260
1262
 
1261
1263
  inline void Producer::PreProcessRtpPacket(RTC::RtpPacket* packet)
@@ -1637,7 +1639,8 @@ namespace RTC
1637
1639
  this->rtpStreamScores[rtpStream->GetEncodingIdx()] = score;
1638
1640
 
1639
1641
  // Notify the listener.
1640
- this->listener->OnProducerRtpStreamScore(this, rtpStream, score, previousScore);
1642
+ this->listener->OnProducerRtpStreamScore(
1643
+ this, static_cast<RTC::RtpStreamRecv*>(rtpStream), score, previousScore);
1641
1644
 
1642
1645
  // Emit the score event.
1643
1646
  EmitScore();
@@ -659,7 +659,10 @@ namespace RTC
659
659
  }
660
660
 
661
661
  inline void Router::OnTransportProducerNewRtpStream(
662
- RTC::Transport* /*transport*/, RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc)
662
+ RTC::Transport* /*transport*/,
663
+ RTC::Producer* producer,
664
+ RTC::RtpStreamRecv* rtpStream,
665
+ uint32_t mappedSsrc)
663
666
  {
664
667
  MS_TRACE();
665
668
 
@@ -674,7 +677,7 @@ namespace RTC
674
677
  inline void Router::OnTransportProducerRtpStreamScore(
675
678
  RTC::Transport* /*transport*/,
676
679
  RTC::Producer* producer,
677
- RTC::RtpStream* rtpStream,
680
+ RTC::RtpStreamRecv* rtpStream,
678
681
  uint8_t score,
679
682
  uint8_t previousScore)
680
683
  {
@@ -689,7 +692,7 @@ namespace RTC
689
692
  }
690
693
 
691
694
  inline void Router::OnTransportProducerRtcpSenderReport(
692
- RTC::Transport* /*transport*/, RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first)
695
+ RTC::Transport* /*transport*/, RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, bool first)
693
696
  {
694
697
  MS_TRACE();
695
698
 
@@ -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()
@@ -147,14 +147,14 @@ namespace RTC
147
147
  }
148
148
  }
149
149
 
150
- void SimpleConsumer::ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t /*mappedSsrc*/)
150
+ void SimpleConsumer::ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t /*mappedSsrc*/)
151
151
  {
152
152
  MS_TRACE();
153
153
 
154
154
  this->producerRtpStream = rtpStream;
155
155
  }
156
156
 
157
- void SimpleConsumer::ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t /*mappedSsrc*/)
157
+ void SimpleConsumer::ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t /*mappedSsrc*/)
158
158
  {
159
159
  MS_TRACE();
160
160
 
@@ -165,7 +165,7 @@ namespace RTC
165
165
  }
166
166
 
167
167
  void SimpleConsumer::ProducerRtpStreamScore(
168
- RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
168
+ RTC::RtpStreamRecv* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
169
169
  {
170
170
  MS_TRACE();
171
171
 
@@ -173,7 +173,7 @@ namespace RTC
173
173
  EmitScore();
174
174
  }
175
175
 
176
- void SimpleConsumer::ProducerRtcpSenderReport(RTC::RtpStream* /*rtpStream*/, bool /*first*/)
176
+ void SimpleConsumer::ProducerRtcpSenderReport(RTC::RtpStreamRecv* /*rtpStream*/, bool /*first*/)
177
177
  {
178
178
  MS_TRACE();
179
179
 
@@ -1,3 +1,4 @@
1
+
1
2
  #define MS_CLASS "RTC::SimulcastConsumer"
2
3
  // #define MS_LOG_DEV_LEVEL 3
3
4
 
@@ -302,7 +303,7 @@ namespace RTC
302
303
  }
303
304
  }
304
305
 
305
- void SimulcastConsumer::ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc)
306
+ void SimulcastConsumer::ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc)
306
307
  {
307
308
  MS_TRACE();
308
309
 
@@ -315,7 +316,7 @@ namespace RTC
315
316
  this->producerRtpStreams[spatialLayer] = rtpStream;
316
317
  }
317
318
 
318
- void SimulcastConsumer::ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc)
319
+ void SimulcastConsumer::ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc)
319
320
  {
320
321
  MS_TRACE();
321
322
 
@@ -335,7 +336,7 @@ namespace RTC
335
336
  }
336
337
 
337
338
  void SimulcastConsumer::ProducerRtpStreamScore(
338
- RTC::RtpStream* /*rtpStream*/, uint8_t score, uint8_t previousScore)
339
+ RTC::RtpStreamRecv* /*rtpStream*/, uint8_t score, uint8_t previousScore)
339
340
  {
340
341
  MS_TRACE();
341
342
 
@@ -344,9 +345,14 @@ namespace RTC
344
345
 
345
346
  if (RTC::Consumer::IsActive())
346
347
  {
348
+ // All Producer streams are dead.
349
+ if (!IsActive())
350
+ {
351
+ UpdateTargetLayers(-1, -1);
352
+ }
347
353
  // Just check target layers if the stream has died or reborned.
348
354
  // clang-format off
349
- if (
355
+ else if (
350
356
  !this->externallyManagedBitrate ||
351
357
  (score == 0u || previousScore == 0u)
352
358
  )
@@ -357,7 +363,7 @@ namespace RTC
357
363
  }
358
364
  }
359
365
 
360
- void SimulcastConsumer::ProducerRtcpSenderReport(RTC::RtpStream* rtpStream, bool first)
366
+ void SimulcastConsumer::ProducerRtcpSenderReport(RTC::RtpStreamRecv* rtpStream, bool first)
361
367
  {
362
368
  MS_TRACE();
363
369
 
@@ -1533,7 +1539,7 @@ namespace RTC
1533
1539
  this->shared->channelNotifier->Emit(this->id, "layerschange", data);
1534
1540
  }
1535
1541
 
1536
- inline RTC::RtpStream* SimulcastConsumer::GetProducerCurrentRtpStream() const
1542
+ inline RTC::RtpStreamRecv* SimulcastConsumer::GetProducerCurrentRtpStream() const
1537
1543
  {
1538
1544
  MS_TRACE();
1539
1545
 
@@ -1544,7 +1550,7 @@ namespace RTC
1544
1550
  return this->producerRtpStreams.at(this->currentSpatialLayer);
1545
1551
  }
1546
1552
 
1547
- inline RTC::RtpStream* SimulcastConsumer::GetProducerTargetRtpStream() const
1553
+ inline RTC::RtpStreamRecv* SimulcastConsumer::GetProducerTargetRtpStream() const
1548
1554
  {
1549
1555
  MS_TRACE();
1550
1556
 
@@ -1555,7 +1561,7 @@ namespace RTC
1555
1561
  return this->producerRtpStreams.at(this->targetSpatialLayer);
1556
1562
  }
1557
1563
 
1558
- inline RTC::RtpStream* SimulcastConsumer::GetProducerTsReferenceRtpStream() const
1564
+ inline RTC::RtpStreamRecv* SimulcastConsumer::GetProducerTsReferenceRtpStream() const
1559
1565
  {
1560
1566
  MS_TRACE();
1561
1567
 
@@ -1567,7 +1573,7 @@ namespace RTC
1567
1573
  }
1568
1574
 
1569
1575
  inline void SimulcastConsumer::OnRtpStreamScore(
1570
- RTC::RtpStream* /*rtpStream*/, uint8_t /*score*/, uint8_t /*previousScore*/)
1576
+ RTC::RtpStream* /*rtpStream*/, uint8_t score, uint8_t /*previousScore*/)
1571
1577
  {
1572
1578
  MS_TRACE();
1573
1579
 
@@ -279,14 +279,14 @@ namespace RTC
279
279
  }
280
280
  }
281
281
 
282
- void SvcConsumer::ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t /*mappedSsrc*/)
282
+ void SvcConsumer::ProducerRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t /*mappedSsrc*/)
283
283
  {
284
284
  MS_TRACE();
285
285
 
286
286
  this->producerRtpStream = rtpStream;
287
287
  }
288
288
 
289
- void SvcConsumer::ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t /*mappedSsrc*/)
289
+ void SvcConsumer::ProducerNewRtpStream(RTC::RtpStreamRecv* rtpStream, uint32_t /*mappedSsrc*/)
290
290
  {
291
291
  MS_TRACE();
292
292
 
@@ -300,7 +300,7 @@ namespace RTC
300
300
  }
301
301
 
302
302
  void SvcConsumer::ProducerRtpStreamScore(
303
- RTC::RtpStream* /*rtpStream*/, uint8_t score, uint8_t previousScore)
303
+ RTC::RtpStreamRecv* /*rtpStream*/, uint8_t score, uint8_t previousScore)
304
304
  {
305
305
  MS_TRACE();
306
306
 
@@ -322,7 +322,7 @@ namespace RTC
322
322
  }
323
323
  }
324
324
 
325
- void SvcConsumer::ProducerRtcpSenderReport(RTC::RtpStream* /*rtpStream*/, bool /*first*/)
325
+ void SvcConsumer::ProducerRtcpSenderReport(RTC::RtpStreamRecv* /*rtpStream*/, bool /*first*/)
326
326
  {
327
327
  MS_TRACE();
328
328
 
@@ -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();
@@ -2617,7 +2621,7 @@ namespace RTC
2617
2621
  }
2618
2622
 
2619
2623
  inline void Transport::OnProducerNewRtpStream(
2620
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint32_t mappedSsrc)
2624
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, uint32_t mappedSsrc)
2621
2625
  {
2622
2626
  MS_TRACE();
2623
2627
 
@@ -2625,7 +2629,7 @@ namespace RTC
2625
2629
  }
2626
2630
 
2627
2631
  inline void Transport::OnProducerRtpStreamScore(
2628
- RTC::Producer* producer, RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore)
2632
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, uint8_t score, uint8_t previousScore)
2629
2633
  {
2630
2634
  MS_TRACE();
2631
2635
 
@@ -2633,7 +2637,7 @@ namespace RTC
2633
2637
  }
2634
2638
 
2635
2639
  inline void Transport::OnProducerRtcpSenderReport(
2636
- RTC::Producer* producer, RTC::RtpStream* rtpStream, bool first)
2640
+ RTC::Producer* producer, RTC::RtpStreamRecv* rtpStream, bool first)
2637
2641
  {
2638
2642
  MS_TRACE();
2639
2643
 
@@ -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 };