mediasoup 3.23.2 → 3.24.1

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 (71) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/node/lib/DataProducer.d.ts +1 -1
  3. package/node/lib/DataProducer.d.ts.map +1 -1
  4. package/node/lib/DataProducer.js +2 -2
  5. package/node/lib/DataProducerTypes.d.ts +1 -1
  6. package/node/lib/DataProducerTypes.d.ts.map +1 -1
  7. package/node/lib/fbs/data-producer/send-notification.d.ts +5 -2
  8. package/node/lib/fbs/data-producer/send-notification.d.ts.map +1 -1
  9. package/node/lib/fbs/data-producer/send-notification.js +17 -5
  10. package/node/lib/test/test-PipeTransport.js +75 -4
  11. package/package.json +5 -5
  12. package/worker/fbs/dataProducer.fbs +1 -0
  13. package/worker/include/RTC/DataConsumer.hpp +1 -0
  14. package/worker/include/RTC/DataProducer.hpp +4 -2
  15. package/worker/include/RTC/RateCalculator.hpp +5 -5
  16. package/worker/include/RTC/Router.hpp +2 -1
  17. package/worker/include/RTC/SubchannelsCodec.hpp +27 -17
  18. package/worker/include/RTC/Transport.hpp +4 -2
  19. package/worker/scripts/package-lock.json +6 -6
  20. package/worker/src/Channel/ChannelMessageRegistrator.cpp +2 -0
  21. package/worker/src/Channel/ChannelRequest.cpp +2 -0
  22. package/worker/src/Channel/ChannelSocket.cpp +4 -0
  23. package/worker/src/DepLibUV.cpp +6 -3
  24. package/worker/src/RTC/ActiveSpeakerObserver.cpp +8 -0
  25. package/worker/src/RTC/AudioLevelObserver.cpp +4 -0
  26. package/worker/src/RTC/DataConsumer.cpp +26 -4
  27. package/worker/src/RTC/DataProducer.cpp +11 -4
  28. package/worker/src/RTC/DirectTransport.cpp +4 -0
  29. package/worker/src/RTC/DtlsTransport.cpp +16 -0
  30. package/worker/src/RTC/ICE/IceCandidate.cpp +8 -0
  31. package/worker/src/RTC/ICE/StunPacket.cpp +2 -0
  32. package/worker/src/RTC/NackGenerator.cpp +2 -0
  33. package/worker/src/RTC/PipeTransport.cpp +4 -0
  34. package/worker/src/RTC/PlainTransport.cpp +10 -0
  35. package/worker/src/RTC/PortManager.cpp +8 -0
  36. package/worker/src/RTC/Producer.cpp +4 -0
  37. package/worker/src/RTC/RTCP/CompoundPacket.cpp +8 -0
  38. package/worker/src/RTC/RTCP/Feedback.cpp +8 -0
  39. package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +2 -0
  40. package/worker/src/RTC/RTCP/FeedbackPsSli.cpp +2 -0
  41. package/worker/src/RTC/RTCP/FeedbackPsVbcm.cpp +2 -0
  42. package/worker/src/RTC/RTCP/FeedbackRtpNack.cpp +2 -0
  43. package/worker/src/RTC/RTCP/FeedbackRtpTllei.cpp +2 -0
  44. package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +5 -0
  45. package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +8 -0
  46. package/worker/src/RTC/RTCP/Sdes.cpp +2 -0
  47. package/worker/src/RTC/RTP/Codecs/AV1.cpp +2 -0
  48. package/worker/src/RTC/RTP/Codecs/DependencyDescriptor.cpp +6 -0
  49. package/worker/src/RTC/RTP/Codecs/VP8.cpp +2 -0
  50. package/worker/src/RTC/RateCalculator.cpp +42 -37
  51. package/worker/src/RTC/Router.cpp +12 -3
  52. package/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp +5 -0
  53. package/worker/src/RTC/RtpDictionaries/RtpParameters.cpp +2 -0
  54. package/worker/src/RTC/SCTP/association/Association.cpp +2 -0
  55. package/worker/src/RTC/SCTP/rx/DataTracker.cpp +2 -0
  56. package/worker/src/RTC/SeqManager.cpp +12 -0
  57. package/worker/src/RTC/SrtpSession.cpp +6 -0
  58. package/worker/src/RTC/SubchannelsCodec.cpp +38 -6
  59. package/worker/src/RTC/Transport.cpp +12 -6
  60. package/worker/src/RTC/TransportCongestionControlClient.cpp +12 -0
  61. package/worker/src/RTC/TransportCongestionControlServer.cpp +2 -0
  62. package/worker/src/Utils/BitStream.cpp +2 -0
  63. package/worker/src/Worker.cpp +2 -0
  64. package/worker/src/handles/SignalHandle.cpp +4 -0
  65. package/worker/src/handles/TcpConnectionHandle.cpp +12 -0
  66. package/worker/src/handles/TcpServerHandle.cpp +6 -0
  67. package/worker/src/handles/TimerHandle.cpp +4 -0
  68. package/worker/src/handles/UdpSocketHandle.cpp +10 -0
  69. package/worker/src/handles/UnixStreamSocketHandle.cpp +10 -0
  70. package/worker/test/src/RTC/TestRateCalculator.cpp +45 -45
  71. package/worker/test/src/RTC/TestSubchannelsCodec.cpp +161 -19
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ### NEXT
4
4
 
5
+ ### 3.24.1
6
+
7
+ - Worker: Don't check `ignoredSubchannel` in piped `DataConsumers` ([PR #1879](https://github.com/versatica/mediasoup/pull/1879)).
8
+
9
+ ### 3.24.0
10
+
11
+ - `DataProducer.send()`: Add `ignoredSubchannel` optional argument ([PR #1877](https://github.com/versatica/mediasoup/pull/1877)).
12
+
5
13
  ### 3.23.2
6
14
 
7
15
  - Handle subchannels in pipe `DataConsumers` ([PR #1875](https://github.com/versatica/mediasoup/pull/1875)).
@@ -39,7 +39,7 @@ export declare class DataProducerImpl<DataProducerAppData extends AppData = AppD
39
39
  getStats(): Promise<DataProducerStat[]>;
40
40
  pause(): Promise<void>;
41
41
  resume(): Promise<void>;
42
- send(message: string | Buffer, ppid?: number, subchannels?: number[], requiredSubchannel?: number): void;
42
+ send(message: string | Buffer, ppid?: number, subchannels?: number[], requiredSubchannel?: number, ignoredSubchannel?: number): void;
43
43
  private handleWorkerNotifications;
44
44
  private handleListenerError;
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DataProducer.d.ts","sourceRoot":"","sources":["../src/DataProducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gB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AAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB7B,IAAI,CACH,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,iBAAiB,CAAC,EAAE,MAAM,GACxB,IAAI;IA0EP,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,mBAAmB;CAQ3B;AAED,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,gBAAgB,GACpB,eAAe,CAAC,IAAI,CActB;AAcD,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,eAAe,CAAC,YAAY,GAChC,gBAAgB,CAYlB"}
@@ -166,7 +166,7 @@ class DataProducerImpl extends enhancedEvents_1.EnhancedEventEmitter {
166
166
  this.#observer.safeEmit('resume');
167
167
  }
168
168
  }
169
- send(message, ppid, subchannels, requiredSubchannel) {
169
+ send(message, ppid, subchannels, requiredSubchannel, ignoredSubchannel) {
170
170
  if (typeof message !== 'string' && !Buffer.isBuffer(message)) {
171
171
  throw new TypeError('message must be a string or a Buffer');
172
172
  }
@@ -208,7 +208,7 @@ class DataProducerImpl extends enhancedEvents_1.EnhancedEventEmitter {
208
208
  message = Buffer.from(message);
209
209
  }
210
210
  const dataOffset = FbsDataProducer.SendNotification.createDataVector(builder, message);
211
- const notificationOffset = FbsDataProducer.SendNotification.createSendNotification(builder, ppid, dataOffset, subchannelsOffset, requiredSubchannel ?? null);
211
+ const notificationOffset = FbsDataProducer.SendNotification.createSendNotification(builder, ppid, dataOffset, subchannelsOffset, requiredSubchannel ?? null, ignoredSubchannel ?? null);
212
212
  this.#channel.notify(FbsNotification.Event.DATAPRODUCER_SEND, FbsNotification.Body.DataProducer_SendNotification, notificationOffset, this.#internal.dataProducerId);
213
213
  }
214
214
  handleWorkerNotifications() {
@@ -128,6 +128,6 @@ export interface DataProducer<DataProducerAppData extends AppData = AppData> ext
128
128
  /**
129
129
  * Send data (just valid for DataProducers created on a DirectTransport).
130
130
  */
131
- send(message: string | Buffer, ppid?: number, subchannels?: number[], requiredSubchannel?: number): void;
131
+ send(message: string | Buffer, ppid?: number, subchannels?: number[], requiredSubchannel?: number, ignoredSubchannel?: number): void;
132
132
  }
133
133
  //# sourceMappingURL=DataProducerTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataProducerTypes.d.ts","sourceRoot":"","sources":["../src/DataProducerTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,mBAAmB,CAAC,mBAAmB,SAAS,OAAO,GAAG,OAAO,IAC5E;IACC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAA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;OAEG;IACH,IAAI,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE;IAE1C;;OAEG;IACH,IAAI,QAAQ,IAAI,oBAAoB,CAAC;IAErC;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,eAAe,IAAI,IAAI,CAAC;IAExB;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAElC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAExC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;OAEG;IACH,IAAI,CACH,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,iBAAiB,CAAC,EAAE,MAAM,GACxB,IAAI,CAAC;CACR"}
@@ -13,6 +13,7 @@ export declare class SendNotification implements flatbuffers.IUnpackableObject<S
13
13
  subchannelsLength(): number;
14
14
  subchannelsArray(): Uint16Array | null;
15
15
  requiredSubchannel(): number | null;
16
+ ignoredSubchannel(): number | null;
16
17
  static startSendNotification(builder: flatbuffers.Builder): void;
17
18
  static addPpid(builder: flatbuffers.Builder, ppid: number): void;
18
19
  static addData(builder: flatbuffers.Builder, dataOffset: flatbuffers.Offset): void;
@@ -26,8 +27,9 @@ export declare class SendNotification implements flatbuffers.IUnpackableObject<S
26
27
  static createSubchannelsVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
27
28
  static startSubchannelsVector(builder: flatbuffers.Builder, numElems: number): void;
28
29
  static addRequiredSubchannel(builder: flatbuffers.Builder, requiredSubchannel: number): void;
30
+ static addIgnoredSubchannel(builder: flatbuffers.Builder, ignoredSubchannel: number): void;
29
31
  static endSendNotification(builder: flatbuffers.Builder): flatbuffers.Offset;
30
- static createSendNotification(builder: flatbuffers.Builder, ppid: number, dataOffset: flatbuffers.Offset, subchannelsOffset: flatbuffers.Offset, requiredSubchannel: number | null): flatbuffers.Offset;
32
+ static createSendNotification(builder: flatbuffers.Builder, ppid: number, dataOffset: flatbuffers.Offset, subchannelsOffset: flatbuffers.Offset, requiredSubchannel: number | null, ignoredSubchannel: number | null): flatbuffers.Offset;
31
33
  unpack(): SendNotificationT;
32
34
  unpackTo(_o: SendNotificationT): void;
33
35
  }
@@ -36,7 +38,8 @@ export declare class SendNotificationT implements flatbuffers.IGeneratedObject {
36
38
  data: (number)[];
37
39
  subchannels: (number)[];
38
40
  requiredSubchannel: number | null;
39
- constructor(ppid?: number, data?: (number)[], subchannels?: (number)[], requiredSubchannel?: number | null);
41
+ ignoredSubchannel: number | null;
42
+ constructor(ppid?: number, data?: (number)[], subchannels?: (number)[], requiredSubchannel?: number | null, ignoredSubchannel?: number | null);
40
43
  pack(builder: flatbuffers.Builder): flatbuffers.Offset;
41
44
  }
42
45
  //# sourceMappingURL=send-notification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-notification.d.ts","sourceRoot":"","sources":["../../../src/fbs/data-producer/send-notification.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,gBAAiB,YAAW,WAAW,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;IACvF,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,gBAAgB;IAM9D,MAAM,CAAC,yBAAyB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,gBAAgB,GAAE,gBAAgB;IAInG,MAAM,CAAC,qCAAqC,CAAC,EAAE,EAAC,WAAW,CAAC,U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GAAE,MAAU,EAChB,IAAI,GAAE,CAAC,MAAM,CAAC,EAAO,EACrB,WAAW,GAAE,CAAC,MAAM,CAAC,EAAO,EAC5B,kBAAkB,GAAE,MAAM,GAAC,IAAW,EACtC,iBAAiB,GAAE,MAAM,GAAC,IAAW;IAI9C,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAYpD"}
@@ -84,8 +84,12 @@ class SendNotification {
84
84
  const offset = this.bb.__offset(this.bb_pos, 10);
85
85
  return offset ? this.bb.readUint16(this.bb_pos + offset) : null;
86
86
  }
87
+ ignoredSubchannel() {
88
+ const offset = this.bb.__offset(this.bb_pos, 12);
89
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : null;
90
+ }
87
91
  static startSendNotification(builder) {
88
- builder.startObject(4);
92
+ builder.startObject(5);
89
93
  }
90
94
  static addPpid(builder, ppid) {
91
95
  builder.addFieldInt32(0, ppid, 0);
@@ -119,28 +123,34 @@ class SendNotification {
119
123
  static addRequiredSubchannel(builder, requiredSubchannel) {
120
124
  builder.addFieldInt16(3, requiredSubchannel, null);
121
125
  }
126
+ static addIgnoredSubchannel(builder, ignoredSubchannel) {
127
+ builder.addFieldInt16(4, ignoredSubchannel, null);
128
+ }
122
129
  static endSendNotification(builder) {
123
130
  const offset = builder.endObject();
124
131
  builder.requiredField(offset, 6); // data
125
132
  return offset;
126
133
  }
127
- static createSendNotification(builder, ppid, dataOffset, subchannelsOffset, requiredSubchannel) {
134
+ static createSendNotification(builder, ppid, dataOffset, subchannelsOffset, requiredSubchannel, ignoredSubchannel) {
128
135
  SendNotification.startSendNotification(builder);
129
136
  SendNotification.addPpid(builder, ppid);
130
137
  SendNotification.addData(builder, dataOffset);
131
138
  SendNotification.addSubchannels(builder, subchannelsOffset);
132
139
  if (requiredSubchannel !== null)
133
140
  SendNotification.addRequiredSubchannel(builder, requiredSubchannel);
141
+ if (ignoredSubchannel !== null)
142
+ SendNotification.addIgnoredSubchannel(builder, ignoredSubchannel);
134
143
  return SendNotification.endSendNotification(builder);
135
144
  }
136
145
  unpack() {
137
- return new SendNotificationT(this.ppid(), this.bb.createScalarList(this.data.bind(this), this.dataLength()), this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()), this.requiredSubchannel());
146
+ return new SendNotificationT(this.ppid(), this.bb.createScalarList(this.data.bind(this), this.dataLength()), this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()), this.requiredSubchannel(), this.ignoredSubchannel());
138
147
  }
139
148
  unpackTo(_o) {
140
149
  _o.ppid = this.ppid();
141
150
  _o.data = this.bb.createScalarList(this.data.bind(this), this.dataLength());
142
151
  _o.subchannels = this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength());
143
152
  _o.requiredSubchannel = this.requiredSubchannel();
153
+ _o.ignoredSubchannel = this.ignoredSubchannel();
144
154
  }
145
155
  }
146
156
  exports.SendNotification = SendNotification;
@@ -149,16 +159,18 @@ class SendNotificationT {
149
159
  data;
150
160
  subchannels;
151
161
  requiredSubchannel;
152
- constructor(ppid = 0, data = [], subchannels = [], requiredSubchannel = null) {
162
+ ignoredSubchannel;
163
+ constructor(ppid = 0, data = [], subchannels = [], requiredSubchannel = null, ignoredSubchannel = null) {
153
164
  this.ppid = ppid;
154
165
  this.data = data;
155
166
  this.subchannels = subchannels;
156
167
  this.requiredSubchannel = requiredSubchannel;
168
+ this.ignoredSubchannel = ignoredSubchannel;
157
169
  }
158
170
  pack(builder) {
159
171
  const data = SendNotification.createDataVector(builder, this.data);
160
172
  const subchannels = SendNotification.createSubchannelsVector(builder, this.subchannels);
161
- return SendNotification.createSendNotification(builder, this.ppid, data, subchannels, this.requiredSubchannel);
173
+ return SendNotification.createSendNotification(builder, this.ppid, data, subchannels, this.requiredSubchannel, this.ignoredSubchannel);
162
174
  }
163
175
  }
164
176
  exports.SendNotificationT = SendNotificationT;
@@ -933,7 +933,7 @@ test('transport.consumeData() for a pipe DataProducer succeeds with subchannels'
933
933
  const directTransport2 = await ctx.router2.createDirectTransport();
934
934
  const directDataConsumer = await directTransport2.consumeData({
935
935
  dataProducerId: directDataProducer.id,
936
- subchannels: [123, 666],
936
+ subchannels: [123, 666, 777],
937
937
  });
938
938
  const receivedMessages = [];
939
939
  directDataConsumer.on('message', message => {
@@ -967,6 +967,20 @@ test('transport.consumeData() for a pipe DataProducer succeeds with subchannels'
967
967
  /* ppid */ undefined,
968
968
  /* subchannels */ [125],
969
969
  /* requiredSubchannel */ 666);
970
+ // The final `directDataConsumer` is subscribed to subchannel 666 so it must
971
+ // not receive the message.
972
+ directDataProducer.send('hello5',
973
+ /* ppid */ undefined,
974
+ /* subchannels */ [123],
975
+ /* requiredSubchannel */ undefined,
976
+ /* ignoredSubchannel */ 666);
977
+ // The final `directDataConsumer` is subscribed to subchannel 777 so it must
978
+ // not receive the message.
979
+ directDataProducer.send('hello6',
980
+ /* ppid */ undefined,
981
+ /* subchannels */ undefined,
982
+ /* requiredSubchannel */ 123,
983
+ /* ignoredSubchannel */ 777);
970
984
  // Send a message without subchannels so it's guaranteed that it will reach
971
985
  // the final `directDataConsumer`. And wait for reception of this message so
972
986
  // at this time we know that previous ones already reached the final
@@ -975,13 +989,70 @@ test('transport.consumeData() for a pipe DataProducer succeeds with subchannels'
975
989
  directDataConsumer.on('message', message => {
976
990
  const receivedMessage = message.toString('utf8');
977
991
  // Resolve once the last sent message is received.
978
- if (receivedMessage === 'hello5') {
992
+ if (receivedMessage === 'bye') {
979
993
  resolve();
980
994
  }
981
995
  });
982
- directDataProducer.send('hello5');
996
+ directDataProducer.send('bye');
997
+ });
998
+ expect(receivedMessages).toStrictEqual(['hello1', 'hello2', 'bye']);
999
+ }, 2000);
1000
+ test('transport.consumeData() for a pipe DataProducer succeeds with ignoredSubchannel', async () => {
1001
+ const directTransport1 = await ctx.router1.createDirectTransport();
1002
+ const directDataProducer = await directTransport1.produceData({
1003
+ label: 'foo',
1004
+ protocol: 'bar',
1005
+ });
1006
+ const { pipeDataConsumer } = await ctx.router1.pipeToRouter({
1007
+ dataProducerId: directDataProducer.id,
1008
+ router: ctx.router2,
983
1009
  });
984
- expect(receivedMessages).toStrictEqual(['hello1', 'hello2', 'hello5']);
1010
+ const directTransport2 = await ctx.router2.createDirectTransport();
1011
+ const directDataConsumer1 = await directTransport2.consumeData({
1012
+ dataProducerId: directDataProducer.id,
1013
+ subchannels: [111],
1014
+ });
1015
+ const directDataConsumer2 = await directTransport2.consumeData({
1016
+ dataProducerId: directDataProducer.id,
1017
+ subchannels: [222],
1018
+ });
1019
+ // A pipe DataConsumer must be subscribed to the union of the subchannels of
1020
+ // all the DataConsumers behind it.
1021
+ await pipeDataConsumer.setSubchannels([111, 222]);
1022
+ const receivedMessages1 = [];
1023
+ const receivedMessages2 = [];
1024
+ // Resolved once both final DataConsumers have received the last sent message.
1025
+ const allReceived = Promise.all([
1026
+ [directDataConsumer1, receivedMessages1],
1027
+ [directDataConsumer2, receivedMessages2],
1028
+ ].map(([dataConsumer, receivedMessages]) => new Promise(resolve => {
1029
+ dataConsumer.on('message', message => {
1030
+ const receivedMessage = message.toString('utf8');
1031
+ receivedMessages.push(receivedMessage);
1032
+ // Resolve once the last sent message is received.
1033
+ if (receivedMessage === 'bye') {
1034
+ resolve();
1035
+ }
1036
+ });
1037
+ })));
1038
+ // The `pipeDataConsumer` is subscribed to subchannel 111, but being a pipe
1039
+ // DataConsumer it must not apply `ignoredSubchannel` itself. Otherwise it
1040
+ // would drop the message for every DataConsumer behind it rather than just
1041
+ // for `directDataConsumer1`. `ignoredSubchannel` travels within the message
1042
+ // and is applied by the final DataConsumers, so `directDataConsumer2` must
1043
+ // still receive it.
1044
+ directDataProducer.send('hello1',
1045
+ /* ppid */ undefined,
1046
+ /* subchannels */ undefined,
1047
+ /* requiredSubchannel */ undefined,
1048
+ /* ignoredSubchannel */ 111);
1049
+ // Send a message without subchannels so it's guaranteed that it will reach
1050
+ // both final DataConsumers. And wait for reception of this message so at
1051
+ // this time we know whether the previous one reached them.
1052
+ directDataProducer.send('bye');
1053
+ await allReceived;
1054
+ expect(receivedMessages1).toStrictEqual(['bye']);
1055
+ expect(receivedMessages2).toStrictEqual(['hello1', 'bye']);
985
1056
  }, 2000);
986
1057
  test('dataProducer.close() is transmitted to pipe DataConsumer', async () => {
987
1058
  const { pipeDataProducer } = await ctx.router1.pipeToRouter({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.23.2",
3
+ "version": "3.24.1",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -126,17 +126,17 @@
126
126
  "eslint-config-prettier": "^10.1.8",
127
127
  "eslint-plugin-jest": "^29.16.0",
128
128
  "eslint-plugin-prettier": "^5.5.6",
129
- "globals": "^17.8.0",
129
+ "globals": "^17.9.0",
130
130
  "ini": "^7.0.0",
131
131
  "jest": "^30.4.2",
132
- "knip": "^6.29.0",
133
- "marked": "^18.0.7",
132
+ "knip": "^6.32.0",
133
+ "marked": "^18.0.9",
134
134
  "open-cli": "^9.0.0",
135
135
  "pick-port": "^2.2.1",
136
136
  "prettier": "^3.9.6",
137
137
  "ts-jest": "^29.4.12",
138
138
  "typescript": "^6.0.3",
139
- "typescript-eslint": "^8.65.0",
139
+ "typescript-eslint": "^8.66.0",
140
140
  "werift-sctp": "^0.0.11"
141
141
  }
142
142
  }
@@ -31,4 +31,5 @@ table SendNotification {
31
31
  data: [uint8] (required);
32
32
  subchannels: [uint16];
33
33
  required_subchannel: uint16 = null;
34
+ ignored_subchannel: uint16 = null;
34
35
  }
@@ -97,6 +97,7 @@ namespace RTC
97
97
  RTC::SCTP::Message message,
98
98
  std::vector<uint16_t>& subchannels,
99
99
  std::optional<uint16_t> requiredSubchannel,
100
+ std::optional<uint16_t> ignoredSubchannel,
100
101
  const onQueuedCallback* cb = nullptr);
101
102
 
102
103
  /* Methods inherited from Channel::ChannelSocket::RequestHandler. */
@@ -27,7 +27,8 @@ namespace RTC
27
27
  RTC::DataProducer* dataProducer,
28
28
  RTC::SCTP::Message message,
29
29
  std::vector<uint16_t>& subchannels,
30
- std::optional<uint16_t> requiredSubchannel) = 0;
30
+ std::optional<uint16_t> requiredSubchannel,
31
+ std::optional<uint16_t> ignoredSubchannel) = 0;
31
32
  virtual void OnDataProducerPaused(RTC::DataProducer* dataProducer) = 0;
32
33
  virtual void OnDataProducerResumed(RTC::DataProducer* dataProducer) = 0;
33
34
  };
@@ -68,7 +69,8 @@ namespace RTC
68
69
  void ReceiveMessage(
69
70
  RTC::SCTP::Message message,
70
71
  std::vector<uint16_t>& subchannels,
71
- std::optional<uint16_t> requiredSubchannel);
72
+ std::optional<uint16_t> requiredSubchannel,
73
+ std::optional<uint16_t> ignoredSubchannel);
72
74
 
73
75
  /* Methods inherited from Channel::ChannelSocket::RequestHandler. */
74
76
  public:
@@ -41,7 +41,7 @@ namespace RTC
41
41
  struct BufferItem
42
42
  {
43
43
  size_t count{ 0u };
44
- uint64_t time{ 0u };
44
+ uint64_t timeMs{ 0u };
45
45
  };
46
46
 
47
47
  private:
@@ -56,11 +56,11 @@ namespace RTC
56
56
  // Buffer to keep data.
57
57
  std::vector<BufferItem> buffer;
58
58
  // Time (in milliseconds) for last item in the time window.
59
- std::optional<uint64_t> newestItemStartTime{ std::nullopt };
59
+ std::optional<uint64_t> newestItemStartTimeMs{ std::nullopt };
60
60
  // Index for the last item in the time window.
61
61
  int32_t newestItemIndex{ -1 };
62
62
  // Time (in milliseconds) for oldest item in the time window.
63
- std::optional<uint64_t> oldestItemStartTime{ std::nullopt };
63
+ std::optional<uint64_t> oldestItemStartTimeMs{ std::nullopt };
64
64
  // Index for the oldest item in the time window.
65
65
  int32_t oldestItemIndex{ -1 };
66
66
  // Total count in the time window.
@@ -70,7 +70,7 @@ namespace RTC
70
70
  // Last value calculated by GetRate().
71
71
  uint32_t lastRate{ 0u };
72
72
  // Last time GetRate() was called.
73
- std::optional<uint64_t> lastTime{ std::nullopt };
73
+ std::optional<uint64_t> lastTimeMs{ std::nullopt };
74
74
  };
75
75
 
76
76
  class RtpDataCounter
@@ -103,7 +103,7 @@ namespace RTC
103
103
  private:
104
104
  SharedInterface* shared{ nullptr };
105
105
  // Whether the size of padding only RTP packets should not be taken into
106
- // account
106
+ // account.
107
107
  bool ignorePaddingOnlyPackets{ false };
108
108
  RateCalculator rate;
109
109
  size_t packets{ 0u };
@@ -100,7 +100,8 @@ namespace RTC
100
100
  RTC::DataProducer* dataProducer,
101
101
  RTC::SCTP::Message message,
102
102
  std::vector<uint16_t>& subchannels,
103
- std::optional<uint16_t> requiredSubchannel) override;
103
+ std::optional<uint16_t> requiredSubchannel,
104
+ std::optional<uint16_t> ignoredSubchannel) override;
104
105
  void OnTransportNewDataConsumer(
105
106
  RTC::Transport* transport,
106
107
  RTC::DataConsumer* dataConsumer,
@@ -8,30 +8,34 @@
8
8
  namespace RTC
9
9
  {
10
10
  /**
11
- * Helper to (optionally) encode/decode subchannels and required subchannel at
12
- * the beginning of an SCTP message payload so that this information travels
13
- * within the SCTP message itself.
11
+ * Helper to (optionally) encode/decode subchannels, required subchannel and
12
+ * ignored subchannel at the beginning of an SCTP message payload so that this
13
+ * information travels within the SCTP message itself.
14
14
  */
15
15
  class SubchannelsCodec
16
16
  {
17
17
  /**
18
18
  * Wire layout of the encoded header prepended to the message payload (all
19
- * fields in network byte order). `R` is the `requiredSubchannelFlag`, i.e.
20
- * the least significant bit of the Magic Token. The `requiredSubchannel`
21
- * field is only present when `R` is 1.
19
+ * fields in network byte order). `R` is the `requiredSubchannelFlag` (second
20
+ * least significant bit of the Magic Token) and `I` is the
21
+ * `ignoredSubchannelFlag` (least significant bit of the Magic Token). The
22
+ * `requiredSubchannel` field is only present when `R` is 1. The
23
+ * `ignoredSubchannel` field is only present when `I` is 1.
22
24
  *
23
25
  * 0 1 2 3
24
26
  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
25
27
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26
28
  * | Magic Token (1/2) |
27
29
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28
- * | Magic Token (2/2) |R|
30
+ * | Magic Token (2/2) |R|I|
29
31
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30
32
  * | subchannelsCount | Subchannel 0 |
31
33
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32
34
  * | ... |
33
35
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34
- * | Subchannel N-1 | requiredSubchannel (if R=1) |
36
+ * | Subchannel N-2 | Subchannel N-1 |
37
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38
+ * | requiredSubchannel (if R=1) | ignoredSubchannel (if I=1) |
35
39
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36
40
  */
37
41
 
@@ -41,35 +45,41 @@ namespace RTC
41
45
  * made of non-printable high bytes and starts with a byte that is not a valid
42
46
  * UTF-8 leading byte (0x80-0xBF), so a real string message (valid UTF-8) can
43
47
  * never begin with it and the chance of colliding with a binary message is
44
- * negligible. Its least significant bit is reserved as the
45
- * `requiredSubchannelFlag`, so it is always 0 in the token constant itself.
48
+ * negligible. Its least significant bits are reserved for the
49
+ * `requiredSubchannelFlag` and `ignoredSubchannelFlag`, so they are always 0
50
+ * in the token constant itself.
46
51
  */
47
52
  static constexpr uint64_t MagicToken{ 0xA5F09CB3D6E1F28C };
48
- static constexpr uint64_t RequiredSubchannelFlagMask{ 0x1 };
53
+ static constexpr uint64_t RequiredSubchannelFlagMask{ 0x2 };
54
+ static constexpr uint64_t IgnoredSubchannelFlagMask{ 0x1 };
55
+ static constexpr uint64_t FlagsMask{ RequiredSubchannelFlagMask | IgnoredSubchannelFlagMask };
49
56
 
50
57
  public:
51
58
  /**
52
- * If `subchannels` is not empty or `requiredSubchannel` has value, encodes
53
- * them at the beginning of the given message payload.
59
+ * If `subchannels` is not empty or `requiredSubchannel` or `ignoredSubchannel`
60
+ * has value, encodes them at the beginning of the given message payload.
54
61
  *
55
62
  * @returns true if the message was encoded, false otherwise.
56
63
  */
57
64
  static bool EncodeSubchannels(
58
65
  RTC::SCTP::Message& message,
59
66
  const std::vector<uint16_t>& subchannels,
60
- std::optional<uint16_t> requiredSubchannel);
67
+ std::optional<uint16_t> requiredSubchannel,
68
+ std::optional<uint16_t> ignoredSubchannel);
61
69
 
62
70
  /**
63
71
  * If the given message payload starts with the Magic Token, extracts the
64
- * encoded subchannels and (optionally) the required subchannel, fills the
65
- * given arguments and removes the encoded header from the message payload.
72
+ * encoded subchannels and (optionally) the required and/or ignored subchannel,
73
+ * fills the given arguments and removes the encoded header from the message
74
+ * payload.
66
75
  *
67
76
  * @returns true if the message was successfully decoded, false otherwise.
68
77
  */
69
78
  static bool DecodeSubchannels(
70
79
  RTC::SCTP::Message& message,
71
80
  std::vector<uint16_t>& subchannels,
72
- std::optional<uint16_t>& requiredSubchannel);
81
+ std::optional<uint16_t>& requiredSubchannel,
82
+ std::optional<uint16_t>& ignoredSubchannel);
73
83
  };
74
84
  } // namespace RTC
75
85
 
@@ -108,7 +108,8 @@ namespace RTC
108
108
  RTC::DataProducer* dataProducer,
109
109
  RTC::SCTP::Message message,
110
110
  std::vector<uint16_t>& subchannels,
111
- std::optional<uint16_t> requiredSubchannel) = 0;
111
+ std::optional<uint16_t> requiredSubchannel,
112
+ std::optional<uint16_t> ignoredSubchannel) = 0;
112
113
  virtual void OnTransportNewDataConsumer(
113
114
  RTC::Transport* transport,
114
115
  RTC::DataConsumer* dataConsumer,
@@ -285,7 +286,8 @@ namespace RTC
285
286
  RTC::DataProducer* dataProducer,
286
287
  RTC::SCTP::Message message,
287
288
  std::vector<uint16_t>& subchannels,
288
- std::optional<uint16_t> requiredSubchannel) override;
289
+ std::optional<uint16_t> requiredSubchannel,
290
+ std::optional<uint16_t> ignoredSubchannel) override;
289
291
  void OnDataProducerPaused(RTC::DataProducer* dataProducer) override;
290
292
  void OnDataProducerResumed(RTC::DataProducer* dataProducer) override;
291
293
 
@@ -21,9 +21,9 @@
21
21
  }
22
22
  },
23
23
  "node_modules/brace-expansion": {
24
- "version": "5.0.8",
25
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
26
- "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
24
+ "version": "5.0.9",
25
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
26
+ "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "balanced-match": "^4.0.2"
@@ -105,9 +105,9 @@
105
105
  "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="
106
106
  },
107
107
  "brace-expansion": {
108
- "version": "5.0.8",
109
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
110
- "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
108
+ "version": "5.0.9",
109
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
110
+ "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
111
111
  "requires": {
112
112
  "balanced-match": "^4.0.2"
113
113
  }
@@ -24,6 +24,8 @@ namespace Channel
24
24
  flatbuffers::Offset<FBS::Worker::ChannelMessageHandlers> ChannelMessageRegistrator::FillBuffer(
25
25
  flatbuffers::FlatBufferBuilder& builder)
26
26
  {
27
+ MS_TRACE();
28
+
27
29
  // Add channelRequestHandlerIds.
28
30
  std::vector<flatbuffers::Offset<flatbuffers::String>> channelRequestHandlerIds;
29
31
 
@@ -183,6 +183,8 @@ namespace Channel
183
183
 
184
184
  void ChannelRequest::Send(const uint8_t* buffer, size_t size) const
185
185
  {
186
+ MS_TRACE();
187
+
186
188
  this->channel->Send(buffer, size);
187
189
  }
188
190
 
@@ -16,6 +16,8 @@ namespace Channel
16
16
 
17
17
  inline static void onAsync(uv_handle_t* handle)
18
18
  {
19
+ MS_TRACE_STD();
20
+
19
21
  while (static_cast<ChannelSocket*>(handle->data)->CallbackRead())
20
22
  {
21
23
  // Read while there are new messages.
@@ -24,6 +26,8 @@ namespace Channel
24
26
 
25
27
  inline static void onCloseAsync(uv_handle_t* handle)
26
28
  {
29
+ MS_TRACE_STD();
30
+
27
31
  delete reinterpret_cast<uv_async_t*>(handle);
28
32
  }
29
33
 
@@ -12,12 +12,14 @@ thread_local uv_loop_t* DepLibUV::loop{ nullptr };
12
12
 
13
13
  inline static void onCloseLoop(uv_handle_t* handle)
14
14
  {
15
+ MS_TRACE_STD();
16
+
15
17
  delete reinterpret_cast<uv_loop_t*>(handle);
16
18
  }
17
19
 
18
20
  inline static void onWalk(uv_handle_t* handle, void* /*arg*/)
19
21
  {
20
- // Must use MS_ERROR_STD since at this point the Channel is already closed.
22
+ // Must use MS_ERROR_STD() since at this point the Channel is already closed.
21
23
  MS_ERROR_STD(
22
24
  "alive UV handle found (this shouldn't happen) [type:%s, active:%d, closing:%d, has_ref:%d]",
23
25
  uv_handle_type_name(handle->type),
@@ -35,7 +37,8 @@ inline static void onWalk(uv_handle_t* handle, void* /*arg*/)
35
37
 
36
38
  void DepLibUV::ClassInit()
37
39
  {
38
- // NOTE: Logger depends on this so we cannot log anything here.
40
+ // Must use MS_TRACE_STD() since the Channel is not yet created.
41
+ MS_TRACE_STD();
39
42
 
40
43
  DepLibUV::loop = new uv_loop_t;
41
44
 
@@ -49,7 +52,7 @@ void DepLibUV::ClassInit()
49
52
 
50
53
  void DepLibUV::ClassDestroy()
51
54
  {
52
- MS_TRACE();
55
+ MS_TRACE_STD();
53
56
 
54
57
  // Here we should not have any UV handle left. All them should have been
55
58
  // already closed+freed. However, in order to not introduce regressions