mediasoup 3.20.8 → 3.20.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 (135) hide show
  1. package/README.md +8 -2
  2. package/node/lib/WebRtcServer.d.ts.map +1 -1
  3. package/node/lib/WebRtcServer.js +0 -7
  4. package/node/lib/WebRtcServerTypes.d.ts +0 -5
  5. package/node/lib/WebRtcServerTypes.d.ts.map +1 -1
  6. package/node/lib/Worker.d.ts +1 -1
  7. package/node/lib/Worker.d.ts.map +1 -1
  8. package/node/lib/Worker.js +1 -11
  9. package/node/lib/WorkerTypes.d.ts +0 -9
  10. package/node/lib/WorkerTypes.d.ts.map +1 -1
  11. package/node/lib/fbs/plain-transport/connect-response.d.ts.map +1 -1
  12. package/node/lib/fbs/plain-transport/connect-response.js +0 -1
  13. package/node/lib/fbs/web-rtc-server/dump-response.d.ts +2 -9
  14. package/node/lib/fbs/web-rtc-server/dump-response.d.ts.map +1 -1
  15. package/node/lib/fbs/web-rtc-server/dump-response.js +5 -33
  16. package/node/lib/fbs/web-rtc-server.d.ts +0 -1
  17. package/node/lib/fbs/web-rtc-server.d.ts.map +1 -1
  18. package/node/lib/fbs/web-rtc-server.js +1 -4
  19. package/node/lib/fbs/worker/dump-response.d.ts +1 -5
  20. package/node/lib/fbs/worker/dump-response.d.ts.map +1 -1
  21. package/node/lib/fbs/worker/dump-response.js +3 -16
  22. package/node/lib/index.d.ts +1 -1
  23. package/node/lib/index.d.ts.map +1 -1
  24. package/node/lib/index.js +1 -2
  25. package/node/lib/test/test-PlainTransport.js +30 -0
  26. package/node/lib/test/test-WebRtcServer.js +0 -7
  27. package/node/lib/test/test-Worker.js +0 -1
  28. package/npm-scripts.mjs +132 -55
  29. package/package.json +6 -4
  30. package/worker/fbs/webRtcServer.fbs +0 -6
  31. package/worker/include/RTC/TransportTuple.hpp +70 -14
  32. package/worker/include/RTC/WebRtcServer.hpp +5 -2
  33. package/worker/include/Utils.hpp +6 -0
  34. package/worker/src/RTC/PortManager.cpp +16 -20
  35. package/worker/src/RTC/SeqManager.cpp +4 -1
  36. package/worker/src/RTC/TransportTuple.cpp +87 -50
  37. package/worker/src/RTC/WebRtcServer.cpp +20 -29
  38. package/worker/test/src/RTC/TestSeqManager.cpp +167 -62
  39. package/worker/test/src/RTC/TestTransportTuple.cpp +21 -14
  40. package/node/lib/fbs/data-consumer/binary.d.ts +0 -25
  41. package/node/lib/fbs/data-consumer/binary.d.ts.map +0 -1
  42. package/node/lib/fbs/data-consumer/binary.js +0 -110
  43. package/node/lib/fbs/data-consumer/data.d.ts +0 -10
  44. package/node/lib/fbs/data-consumer/data.d.ts.map +0 -1
  45. package/node/lib/fbs/data-consumer/data.js +0 -30
  46. package/node/lib/fbs/data-consumer/string.d.ts +0 -22
  47. package/node/lib/fbs/data-consumer/string.d.ts.map +0 -1
  48. package/node/lib/fbs/data-consumer/string.js +0 -92
  49. package/node/lib/fbs/data-producer/binary.d.ts +0 -25
  50. package/node/lib/fbs/data-producer/binary.d.ts.map +0 -1
  51. package/node/lib/fbs/data-producer/binary.js +0 -110
  52. package/node/lib/fbs/data-producer/data.d.ts +0 -10
  53. package/node/lib/fbs/data-producer/data.d.ts.map +0 -1
  54. package/node/lib/fbs/data-producer/data.js +0 -30
  55. package/node/lib/fbs/data-producer/string.d.ts +0 -22
  56. package/node/lib/fbs/data-producer/string.d.ts.map +0 -1
  57. package/node/lib/fbs/data-producer/string.js +0 -92
  58. package/node/lib/fbs/lib-uring/dump.d.ts +0 -27
  59. package/node/lib/fbs/lib-uring/dump.d.ts.map +0 -1
  60. package/node/lib/fbs/lib-uring/dump.js +0 -113
  61. package/node/lib/fbs/lib-uring.d.ts +0 -2
  62. package/node/lib/fbs/lib-uring.d.ts.map +0 -1
  63. package/node/lib/fbs/lib-uring.js +0 -8
  64. package/node/lib/fbs/message/type.d.ts +0 -7
  65. package/node/lib/fbs/message/type.d.ts.map +0 -1
  66. package/node/lib/fbs/message/type.js +0 -11
  67. package/node/lib/fbs/message-from-worker/body.d.ts +0 -12
  68. package/node/lib/fbs/message-from-worker/body.d.ts.map +0 -1
  69. package/node/lib/fbs/message-from-worker/body.js +0 -34
  70. package/node/lib/fbs/message-from-worker/message.d.ts +0 -30
  71. package/node/lib/fbs/message-from-worker/message.d.ts.map +0 -1
  72. package/node/lib/fbs/message-from-worker/message.js +0 -122
  73. package/node/lib/fbs/message-from-worker.d.ts +0 -3
  74. package/node/lib/fbs/message-from-worker.d.ts.map +0 -1
  75. package/node/lib/fbs/message-from-worker.js +0 -9
  76. package/node/lib/fbs/message-to-worker/body.d.ts +0 -10
  77. package/node/lib/fbs/message-to-worker/body.d.ts.map +0 -1
  78. package/node/lib/fbs/message-to-worker/body.js +0 -30
  79. package/node/lib/fbs/message-to-worker/message.d.ts +0 -29
  80. package/node/lib/fbs/message-to-worker/message.d.ts.map +0 -1
  81. package/node/lib/fbs/message-to-worker/message.js +0 -122
  82. package/node/lib/fbs/message-to-worker.d.ts +0 -3
  83. package/node/lib/fbs/message-to-worker.d.ts.map +0 -1
  84. package/node/lib/fbs/message-to-worker.js +0 -9
  85. package/node/lib/fbs/notification-from-worker/body.d.ts +0 -44
  86. package/node/lib/fbs/notification-from-worker/body.d.ts.map +0 -1
  87. package/node/lib/fbs/notification-from-worker/body.js +0 -98
  88. package/node/lib/fbs/notification-from-worker/event.d.ts +0 -31
  89. package/node/lib/fbs/notification-from-worker/event.d.ts.map +0 -1
  90. package/node/lib/fbs/notification-from-worker/event.js +0 -35
  91. package/node/lib/fbs/notification-from-worker/notification.d.ts +0 -52
  92. package/node/lib/fbs/notification-from-worker/notification.d.ts.map +0 -1
  93. package/node/lib/fbs/notification-from-worker/notification.js +0 -140
  94. package/node/lib/fbs/notification-from-worker.d.ts +0 -4
  95. package/node/lib/fbs/notification-from-worker.d.ts.map +0 -1
  96. package/node/lib/fbs/notification-from-worker.js +0 -11
  97. package/node/lib/fbs/notification-to-worker/body.d.ts +0 -12
  98. package/node/lib/fbs/notification-to-worker/body.d.ts.map +0 -1
  99. package/node/lib/fbs/notification-to-worker/body.js +0 -34
  100. package/node/lib/fbs/notification-to-worker/event.d.ts +0 -6
  101. package/node/lib/fbs/notification-to-worker/event.d.ts.map +0 -1
  102. package/node/lib/fbs/notification-to-worker/event.js +0 -10
  103. package/node/lib/fbs/notification-to-worker/notification.d.ts +0 -36
  104. package/node/lib/fbs/notification-to-worker/notification.d.ts.map +0 -1
  105. package/node/lib/fbs/notification-to-worker/notification.js +0 -140
  106. package/node/lib/fbs/notification-to-worker.d.ts +0 -4
  107. package/node/lib/fbs/notification-to-worker.d.ts.map +0 -1
  108. package/node/lib/fbs/notification-to-worker.js +0 -11
  109. package/node/lib/fbs/sctp-parameters/num-sctp-streams.d.ts +0 -24
  110. package/node/lib/fbs/sctp-parameters/num-sctp-streams.d.ts.map +0 -1
  111. package/node/lib/fbs/sctp-parameters/num-sctp-streams.js +0 -102
  112. package/node/lib/fbs/trace-events/fir-trace-info.d.ts +0 -21
  113. package/node/lib/fbs/trace-events/fir-trace-info.d.ts.map +0 -1
  114. package/node/lib/fbs/trace-events/fir-trace-info.js +0 -90
  115. package/node/lib/fbs/trace-events/key-frame-trace-info.d.ts +0 -25
  116. package/node/lib/fbs/trace-events/key-frame-trace-info.d.ts.map +0 -1
  117. package/node/lib/fbs/trace-events/key-frame-trace-info.js +0 -104
  118. package/node/lib/fbs/trace-events/pli-trace-info.d.ts +0 -21
  119. package/node/lib/fbs/trace-events/pli-trace-info.d.ts.map +0 -1
  120. package/node/lib/fbs/trace-events/pli-trace-info.js +0 -90
  121. package/node/lib/fbs/trace-events/rtp-trace-info.d.ts +0 -25
  122. package/node/lib/fbs/trace-events/rtp-trace-info.d.ts.map +0 -1
  123. package/node/lib/fbs/trace-events/rtp-trace-info.js +0 -104
  124. package/node/lib/fbs/trace-events/trace-event-type.d.ts +0 -8
  125. package/node/lib/fbs/trace-events/trace-event-type.d.ts.map +0 -1
  126. package/node/lib/fbs/trace-events/trace-event-type.js +0 -12
  127. package/node/lib/fbs/trace-events/trace-info.d.ts +0 -14
  128. package/node/lib/fbs/trace-events/trace-info.d.ts.map +0 -1
  129. package/node/lib/fbs/trace-events/trace-info.js +0 -38
  130. package/node/lib/fbs/trace-events.d.ts +0 -7
  131. package/node/lib/fbs/trace-events.d.ts.map +0 -1
  132. package/node/lib/fbs/trace-events.js +0 -20
  133. package/node/lib/fbs/web-rtc-server/tuple-hash.d.ts +0 -25
  134. package/node/lib/fbs/web-rtc-server/tuple-hash.d.ts.map +0 -1
  135. package/node/lib/fbs/web-rtc-server/tuple-hash.js +0 -104
@@ -797,11 +797,6 @@ namespace RTC
797
797
  const auto protocolBits = static_cast<uint8_t>(key.protocol);
798
798
  const auto familyBits = static_cast<uint16_t>(key.bindAddr.ss_family);
799
799
 
800
- auto hashCombine = [](size_t& seed, size_t value)
801
- {
802
- seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
803
- };
804
-
805
800
  size_t seed = 0;
806
801
 
807
802
  switch (key.bindAddr.ss_family)
@@ -810,11 +805,12 @@ namespace RTC
810
805
  {
811
806
  const auto* in = reinterpret_cast<const sockaddr_in*>(std::addressof(key.bindAddr));
812
807
 
813
- hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
814
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
815
- hashCombine(seed, ankerl::unordered_dense::hash<uint32_t>{}(in->sin_addr.s_addr));
816
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
817
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
808
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
809
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
810
+ Utils::Crypto::HashCombine(
811
+ seed, ankerl::unordered_dense::hash<uint32_t>{}(in->sin_addr.s_addr));
812
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
813
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
818
814
 
819
815
  break;
820
816
  }
@@ -830,22 +826,22 @@ namespace RTC
830
826
  std::memcpy(std::addressof(hi), addr, sizeof(uint64_t));
831
827
  std::memcpy(std::addressof(lo), addr + sizeof(uint64_t), sizeof(uint64_t));
832
828
 
833
- hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
834
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
835
- hashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(hi));
836
- hashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(lo));
837
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
838
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
829
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
830
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
831
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(hi));
832
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(lo));
833
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
834
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
839
835
 
840
836
  break;
841
837
  }
842
838
 
843
839
  default:
844
840
  {
845
- hashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
846
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
847
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
848
- hashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
841
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
842
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
843
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.minPort));
844
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(key.maxPort));
849
845
 
850
846
  break;
851
847
  }
@@ -187,7 +187,10 @@ namespace RTC
187
187
  template<typename T, uint8_t N>
188
188
  T SeqManager<T, N>::GetMaxOutput() const
189
189
  {
190
- return this->maxOutput;
190
+ // 'maxOutput' is stored in the offset-less space (as 'base' and comparisons
191
+ // use it), so apply 'initialOutput' here, just like `Input()` does before
192
+ // returning the output to the caller.
193
+ return (this->maxOutput + this->initialOutput) & SeqManager::MaxValue;
191
194
  }
192
195
 
193
196
  /*
@@ -49,22 +49,6 @@ namespace RTC
49
49
  }
50
50
  }
51
51
 
52
- uint64_t TransportTuple::GenerateFnv1aHash(const uint8_t* data, size_t size)
53
- {
54
- MS_TRACE();
55
-
56
- const uint64_t fnvOffsetBasis = 14695981039346656037ull;
57
- const uint64_t fnvPrime = 1099511628211ull;
58
- uint64_t hash = fnvOffsetBasis;
59
-
60
- for (size_t i = 0; i < size; ++i)
61
- {
62
- hash = (hash ^ data[i]) * fnvPrime;
63
- }
64
-
65
- return hash;
66
- }
67
-
68
52
  /* Instance methods. */
69
53
 
70
54
  void TransportTuple::CloseTcpConnection()
@@ -143,54 +127,107 @@ namespace RTC
143
127
  }
144
128
  }
145
129
 
146
- MS_DUMP_CLEAN(indentation, " hash: %" PRIu64, this->hash);
147
-
148
130
  MS_DUMP_CLEAN(indentation, "</TransportTuple>");
149
131
  }
150
132
 
151
- void TransportTuple::GenerateHash()
133
+ bool TransportTuple::TupleKey::operator==(const TupleKey& other) const noexcept
152
134
  {
153
135
  MS_TRACE();
154
136
 
155
- const auto* localSockAddr = GetLocalAddress();
156
- const auto* remoteSockAddr = GetRemoteAddress();
157
-
158
- // Maximum buffer length for two IPv6 addresses and ports plus protocol.
159
- static constexpr size_t BufferSize = ((16 + 2) * 2) + 1;
160
- uint8_t buffer[BufferSize] = {};
161
- size_t idx = 0;
137
+ if (this->protocol != other.protocol)
138
+ {
139
+ return false;
140
+ }
162
141
 
163
- auto appendSockAddr = [&](const struct sockaddr* addr)
142
+ switch (this->protocol)
164
143
  {
165
- if (addr->sa_family == AF_INET)
144
+ // For UDP compare the remote address first (it discriminates faster) and then
145
+ // the socket.
146
+ case Protocol::UDP:
166
147
  {
167
- const auto* in = reinterpret_cast<const struct sockaddr_in*>(addr);
168
- const auto* ip = reinterpret_cast<const uint8_t*>(&in->sin_addr.s_addr);
169
- const uint16_t port = ntohs(in->sin_port);
170
-
171
- std::memcpy(buffer + idx, ip, 4);
172
- idx += 4;
173
- buffer[idx++] = (port >> 8) & 0xFF;
174
- buffer[idx++] = port & 0xFF;
148
+ return Utils::IP::CompareAddresses(this->udpRemoteAddr, other.udpRemoteAddr) &&
149
+ this->udpSocketOrTcpConnection == other.udpSocketOrTcpConnection;
175
150
  }
176
- else if (addr->sa_family == AF_INET6)
151
+
152
+ // For TCP the connection pointer fully identifies the tuple.
153
+ case Protocol::TCP:
177
154
  {
178
- const auto* in6 = reinterpret_cast<const struct sockaddr_in6*>(addr);
179
- const auto* ip = reinterpret_cast<const uint8_t*>(&in6->sin6_addr);
180
- const uint16_t port = ntohs(in6->sin6_port);
181
-
182
- std::memcpy(buffer + idx, ip, 16);
183
- idx += 16;
184
- buffer[idx++] = (port >> 8) & 0xFF;
185
- buffer[idx++] = port & 0xFF;
155
+ return this->udpSocketOrTcpConnection == other.udpSocketOrTcpConnection;
186
156
  }
187
- };
188
157
 
189
- appendSockAddr(localSockAddr);
190
- appendSockAddr(remoteSockAddr);
158
+ NO_DEFAULT_GCC();
159
+ }
160
+ }
161
+
162
+ size_t TransportTuple::TupleKeyHash::operator()(const TupleKey& key) const noexcept
163
+ {
164
+ MS_TRACE();
165
+
166
+ const auto protocolBits = static_cast<uint8_t>(key.protocol);
191
167
 
192
- buffer[idx] = static_cast<uint8_t>(this->protocol);
168
+ size_t seed = 0;
193
169
 
194
- this->hash = TransportTuple::GenerateFnv1aHash(buffer, idx + 1);
170
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint8_t>{}(protocolBits));
171
+ Utils::Crypto::HashCombine(
172
+ seed,
173
+ ankerl::unordered_dense::hash<uintptr_t>{}(
174
+ reinterpret_cast<uintptr_t>(key.udpSocketOrTcpConnection)));
175
+
176
+ switch (key.protocol)
177
+ {
178
+ case Protocol::UDP:
179
+ {
180
+ // For UDP also combine the remote address.
181
+ const auto familyBits = static_cast<uint16_t>(key.udpRemoteAddr->sa_family);
182
+
183
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint16_t>{}(familyBits));
184
+
185
+ switch (key.udpRemoteAddr->sa_family)
186
+ {
187
+ case AF_INET:
188
+ {
189
+ const auto* remoteIn = reinterpret_cast<const sockaddr_in*>(key.udpRemoteAddr);
190
+
191
+ Utils::Crypto::HashCombine(
192
+ seed, ankerl::unordered_dense::hash<uint32_t>{}(remoteIn->sin_addr.s_addr));
193
+ Utils::Crypto::HashCombine(
194
+ seed, ankerl::unordered_dense::hash<uint16_t>{}(remoteIn->sin_port));
195
+
196
+ break;
197
+ }
198
+
199
+ case AF_INET6:
200
+ {
201
+ const auto* remoteIn6 = reinterpret_cast<const sockaddr_in6*>(key.udpRemoteAddr);
202
+ const auto* addr = remoteIn6->sin6_addr.s6_addr;
203
+
204
+ uint64_t hi;
205
+ uint64_t lo;
206
+
207
+ std::memcpy(std::addressof(hi), addr, sizeof(uint64_t));
208
+ std::memcpy(std::addressof(lo), addr + sizeof(uint64_t), sizeof(uint64_t));
209
+
210
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(hi));
211
+ Utils::Crypto::HashCombine(seed, ankerl::unordered_dense::hash<uint64_t>{}(lo));
212
+ Utils::Crypto::HashCombine(
213
+ seed, ankerl::unordered_dense::hash<uint16_t>{}(remoteIn6->sin6_port));
214
+
215
+ break;
216
+ }
217
+
218
+ default:;
219
+ }
220
+
221
+ return seed;
222
+ }
223
+
224
+ case Protocol::TCP:
225
+ {
226
+ // For TCP the connection pointer is enough.
227
+ return seed;
228
+ }
229
+
230
+ NO_DEFAULT_GCC();
231
+ }
195
232
  }
196
233
  } // namespace RTC
@@ -303,26 +303,13 @@ namespace RTC
303
303
  builder, localIceUsernameFragment.c_str(), webRtcTransport->id.c_str()));
304
304
  }
305
305
 
306
- // Add tupleHashes.
307
- std::vector<flatbuffers::Offset<FBS::WebRtcServer::TupleHash>> tupleHashes;
308
-
309
- for (const auto& kv : this->mapTupleWebRtcTransport)
310
- {
311
- const auto& tupleHash = kv.first;
312
- const auto* webRtcTransport = kv.second;
313
-
314
- tupleHashes.emplace_back(
315
- FBS::WebRtcServer::CreateTupleHashDirect(builder, tupleHash, webRtcTransport->id.c_str()));
316
- }
317
-
318
306
  return FBS::WebRtcServer::CreateDumpResponseDirect(
319
307
  builder,
320
308
  this->id.c_str(),
321
- &udpSockets,
322
- &tcpServers,
323
- &webRtcTransportIds,
324
- &localIceUsernameFragments,
325
- &tupleHashes);
309
+ std::addressof(udpSockets),
310
+ std::addressof(tcpServers),
311
+ std::addressof(webRtcTransportIds),
312
+ std::addressof(localIceUsernameFragments));
326
313
  }
327
314
 
328
315
  void WebRtcServer::HandleRequest(Channel::ChannelRequest* request)
@@ -450,7 +437,7 @@ namespace RTC
450
437
  }
451
438
 
452
439
  // First try doing lookup in the tuples table.
453
- auto it1 = this->mapTupleWebRtcTransport.find(tuple->hash);
440
+ auto it1 = this->mapTupleWebRtcTransport.find(tuple->GetTupleKey());
454
441
 
455
442
  if (it1 != this->mapTupleWebRtcTransport.end())
456
443
  {
@@ -488,7 +475,7 @@ namespace RTC
488
475
  {
489
476
  MS_TRACE();
490
477
 
491
- auto it = this->mapTupleWebRtcTransport.find(tuple->hash);
478
+ auto it = this->mapTupleWebRtcTransport.find(tuple->GetTupleKey());
492
479
 
493
480
  if (it == this->mapTupleWebRtcTransport.end())
494
481
  {
@@ -562,14 +549,16 @@ namespace RTC
562
549
  {
563
550
  MS_TRACE();
564
551
 
565
- if (this->mapTupleWebRtcTransport.find(tuple->hash) != this->mapTupleWebRtcTransport.end())
552
+ auto tupleKey = tuple->GetTupleKey();
553
+
554
+ if (this->mapTupleWebRtcTransport.contains(tupleKey))
566
555
  {
567
- MS_WARN_TAG(ice, "tuple hash already exists in the table");
556
+ MS_WARN_TAG(ice, "tuple key already exists in the table");
568
557
 
569
558
  return;
570
559
  }
571
560
 
572
- this->mapTupleWebRtcTransport[tuple->hash] = webRtcTransport;
561
+ this->mapTupleWebRtcTransport[tupleKey] = webRtcTransport;
573
562
  }
574
563
 
575
564
  inline void WebRtcServer::OnWebRtcTransportTransportTupleRemoved(
@@ -577,14 +566,16 @@ namespace RTC
577
566
  {
578
567
  MS_TRACE();
579
568
 
580
- if (this->mapTupleWebRtcTransport.find(tuple->hash) == this->mapTupleWebRtcTransport.end())
569
+ auto it = this->mapTupleWebRtcTransport.find(tuple->GetTupleKey());
570
+
571
+ if (it == this->mapTupleWebRtcTransport.end())
581
572
  {
582
- MS_DEBUG_TAG(ice, "tuple hash not found in the table");
573
+ MS_DEBUG_TAG(ice, "tuple key not found in the table");
583
574
 
584
575
  return;
585
576
  }
586
577
 
587
- this->mapTupleWebRtcTransport.erase(tuple->hash);
578
+ this->mapTupleWebRtcTransport.erase(it);
588
579
  }
589
580
 
590
581
  inline void WebRtcServer::OnUdpSocketPacketReceived(
@@ -598,7 +589,7 @@ namespace RTC
598
589
 
599
590
  RTC::TransportTuple tuple(socket, remoteAddr);
600
591
 
601
- OnPacketReceived(&tuple, data, len, bufferLen);
592
+ OnPacketReceived(std::addressof(tuple), data, len, bufferLen);
602
593
  }
603
594
 
604
595
  inline void WebRtcServer::OnRtcTcpConnectionClosed(
@@ -612,7 +603,7 @@ namespace RTC
612
603
  // mapTupleWebRtcTransport because this event may be called after the tuple
613
604
  // was removed from it.
614
605
 
615
- auto it = this->mapTupleWebRtcTransport.find(tuple.hash);
606
+ auto it = this->mapTupleWebRtcTransport.find(tuple.GetTupleKey());
616
607
 
617
608
  if (it == this->mapTupleWebRtcTransport.end())
618
609
  {
@@ -621,7 +612,7 @@ namespace RTC
621
612
 
622
613
  auto* webRtcTransport = it->second;
623
614
 
624
- webRtcTransport->RemoveTuple(&tuple);
615
+ webRtcTransport->RemoveTuple(std::addressof(tuple));
625
616
  }
626
617
 
627
618
  inline void WebRtcServer::OnTcpConnectionPacketReceived(
@@ -631,6 +622,6 @@ namespace RTC
631
622
 
632
623
  RTC::TransportTuple tuple(connection);
633
624
 
634
- OnPacketReceived(&tuple, data, len, bufferLen);
625
+ OnPacketReceived(std::addressof(tuple), data, len, bufferLen);
635
626
  }
636
627
  } // namespace RTC