mediasoup 3.13.21 → 3.13.23

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 (33) hide show
  1. package/package.json +5 -5
  2. package/worker/include/RTC/DtlsTransport.hpp +2 -1
  3. package/worker/src/RTC/Codecs/H264.cpp +6 -6
  4. package/worker/src/RTC/Codecs/H264_SVC.cpp +7 -7
  5. package/worker/src/RTC/Codecs/Opus.cpp +3 -3
  6. package/worker/src/RTC/Codecs/VP8.cpp +17 -17
  7. package/worker/src/RTC/Codecs/VP9.cpp +15 -15
  8. package/worker/src/RTC/DtlsTransport.cpp +101 -77
  9. package/worker/src/RTC/RTCP/Bye.cpp +2 -2
  10. package/worker/src/RTC/RTCP/Feedback.cpp +3 -3
  11. package/worker/src/RTC/RTCP/FeedbackPsFir.cpp +2 -2
  12. package/worker/src/RTC/RTCP/FeedbackPsLei.cpp +1 -1
  13. package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +2 -2
  14. package/worker/src/RTC/RTCP/FeedbackPsRpsi.cpp +3 -3
  15. package/worker/src/RTC/RTCP/FeedbackPsSli.cpp +3 -3
  16. package/worker/src/RTC/RTCP/FeedbackPsTst.cpp +3 -3
  17. package/worker/src/RTC/RTCP/FeedbackPsVbcm.cpp +4 -4
  18. package/worker/src/RTC/RTCP/FeedbackRtpEcn.cpp +7 -7
  19. package/worker/src/RTC/RTCP/FeedbackRtpNack.cpp +2 -2
  20. package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +3 -3
  21. package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +7 -7
  22. package/worker/src/RTC/RTCP/ReceiverReport.cpp +7 -7
  23. package/worker/src/RTC/RTCP/Sdes.cpp +4 -4
  24. package/worker/src/RTC/RTCP/SenderReport.cpp +6 -6
  25. package/worker/src/RTC/RTCP/XrDelaySinceLastRr.cpp +6 -6
  26. package/worker/src/RTC/RTCP/XrReceiverReferenceTime.cpp +5 -5
  27. package/worker/src/RTC/RtpPacket.cpp +25 -28
  28. package/worker/src/RTC/StunPacket.cpp +2 -2
  29. package/worker/src/RTC/TransportTuple.cpp +6 -6
  30. package/worker/src/Settings.cpp +7 -10
  31. package/worker/src/handles/TcpConnectionHandle.cpp +5 -5
  32. package/worker/src/handles/TcpServerHandle.cpp +4 -6
  33. package/worker/src/handles/UdpSocketHandle.cpp +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup",
3
- "version": "3.13.21",
3
+ "version": "3.13.23",
4
4
  "description": "Cutting Edge WebRTC Video Conferencing",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -110,10 +110,10 @@
110
110
  "@octokit/rest": "^20.0.2",
111
111
  "@types/debug": "^4.1.12",
112
112
  "@types/jest": "^29.5.12",
113
- "@types/node": "^20.11.19",
114
- "@typescript-eslint/eslint-plugin": "^7.0.2",
115
- "@typescript-eslint/parser": "^7.0.2",
116
- "eslint": "^8.56.0",
113
+ "@types/node": "^20.11.20",
114
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
115
+ "@typescript-eslint/parser": "^7.1.0",
116
+ "eslint": "^8.57.0",
117
117
  "eslint-config-prettier": "^9.1.0",
118
118
  "eslint-plugin-jest": "^27.9.0",
119
119
  "eslint-plugin-prettier": "^5.1.3",
@@ -152,6 +152,8 @@ namespace RTC
152
152
  return this->localRole;
153
153
  }
154
154
  void SendApplicationData(const uint8_t* data, size_t len);
155
+ // This method must be public since it's called within an OpenSSL callback.
156
+ void SendDtlsData(const uint8_t* data, size_t len);
155
157
 
156
158
  private:
157
159
  bool IsRunning() const
@@ -173,7 +175,6 @@ namespace RTC
173
175
  }
174
176
  void Reset();
175
177
  bool CheckStatus(int returnCode);
176
- void SendPendingOutgoingDtlsData();
177
178
  bool SetTimeout();
178
179
  bool ProcessHandshake();
179
180
  bool CheckRemoteFingerprint();
@@ -161,7 +161,7 @@ namespace RTC
161
161
  {
162
162
  MS_TRACE();
163
163
 
164
- MS_DUMP("<PayloadDescriptor>");
164
+ MS_DUMP("<H264::PayloadDescriptor>");
165
165
  MS_DUMP(
166
166
  " s:%" PRIu8 "|e:%" PRIu8 "|i:%" PRIu8 "|d:%" PRIu8 "|b:%" PRIu8,
167
167
  this->s,
@@ -171,18 +171,18 @@ namespace RTC
171
171
  this->b);
172
172
  if (this->hasTid)
173
173
  {
174
- MS_DUMP(" tid : %" PRIu8, this->tid);
174
+ MS_DUMP(" tid: %" PRIu8, this->tid);
175
175
  }
176
176
  if (this->hasLid)
177
177
  {
178
- MS_DUMP(" lid : %" PRIu8, this->lid);
178
+ MS_DUMP(" lid: %" PRIu8, this->lid);
179
179
  }
180
180
  if (this->hasTl0picidx)
181
181
  {
182
- MS_DUMP(" tl0picidx : %" PRIu8, this->tl0picidx);
182
+ MS_DUMP(" tl0picidx: %" PRIu8, this->tl0picidx);
183
183
  }
184
- MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
185
- MS_DUMP("</PayloadDescriptor>");
184
+ MS_DUMP(" isKeyFrame: %s", this->isKeyFrame ? "true" : "false");
185
+ MS_DUMP("</H264::PayloadDescriptor>");
186
186
  }
187
187
 
188
188
  H264::PayloadDescriptorHandler::PayloadDescriptorHandler(H264::PayloadDescriptor* payloadDescriptor)
@@ -251,7 +251,7 @@ namespace RTC
251
251
  {
252
252
  MS_TRACE();
253
253
 
254
- MS_DUMP("<PayloadDescriptor>");
254
+ MS_DUMP("<H264_SVC::PayloadDescriptor>");
255
255
  MS_DUMP(
256
256
  " s:%" PRIu8 "|e:%" PRIu8 "|i:%" PRIu8 "|d:%" PRIu8 "|b:%" PRIu8,
257
257
  this->s,
@@ -259,12 +259,12 @@ namespace RTC
259
259
  this->i,
260
260
  this->d,
261
261
  this->b);
262
- MS_DUMP(" hasSlIndex : %s", this->hasSlIndex ? "true" : "false");
263
- MS_DUMP(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
264
- MS_DUMP(" tl0picidx : %" PRIu8, this->tl0picidx);
265
- MS_DUMP(" noIntLayerPredFlag : %" PRIu8, this->noIntLayerPredFlag);
266
- MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
267
- MS_DUMP("</PayloadDescriptor>");
262
+ MS_DUMP(" hasSlIndex: %s", this->hasSlIndex ? "true" : "false");
263
+ MS_DUMP(" hasTlIndex: %s", this->hasTlIndex ? "true" : "false");
264
+ MS_DUMP(" tl0picidx: %" PRIu8, this->tl0picidx);
265
+ MS_DUMP(" noIntLayerPredFlag: %" PRIu8, this->noIntLayerPredFlag);
266
+ MS_DUMP(" isKeyFrame: %s", this->isKeyFrame ? "true" : "false");
267
+ MS_DUMP("</H264_SVC::PayloadDescriptor>");
268
268
  }
269
269
 
270
270
  H264_SVC::PayloadDescriptorHandler::PayloadDescriptorHandler(
@@ -45,9 +45,9 @@ namespace RTC
45
45
  {
46
46
  MS_TRACE();
47
47
 
48
- MS_DUMP("<PayloadDescriptor>");
49
- MS_DUMP(" isDtx : %s", this->isDtx ? "true" : "false");
50
- MS_DUMP("</PayloadDescriptor>");
48
+ MS_DUMP("<Opus::PayloadDescriptor>");
49
+ MS_DUMP(" isDtx: %s", this->isDtx ? "true" : "false");
50
+ MS_DUMP("</Opus::PayloadDescriptor>");
51
51
  }
52
52
 
53
53
  Opus::PayloadDescriptorHandler::PayloadDescriptorHandler(Opus::PayloadDescriptor* payloadDescriptor)
@@ -167,25 +167,25 @@ namespace RTC
167
167
  {
168
168
  MS_TRACE();
169
169
 
170
- MS_DUMP("<PayloadDescriptor>");
170
+ MS_DUMP("<VP8::PayloadDescriptor>");
171
171
  MS_DUMP(
172
172
  " i:%" PRIu8 "|l:%" PRIu8 "|t:%" PRIu8 "|k:%" PRIu8, this->i, this->l, this->t, this->k);
173
- MS_DUMP(" extended : %" PRIu8, this->extended);
174
- MS_DUMP(" nonReference : %" PRIu8, this->nonReference);
175
- MS_DUMP(" start : %" PRIu8, this->start);
176
- MS_DUMP(" partitionIndex : %" PRIu8, this->partitionIndex);
177
- MS_DUMP(" pictureId : %" PRIu16, this->pictureId);
178
- MS_DUMP(" tl0PictureIndex : %" PRIu8, this->tl0PictureIndex);
179
- MS_DUMP(" tlIndex : %" PRIu8, this->tlIndex);
180
- MS_DUMP(" y : %" PRIu8, this->y);
181
- MS_DUMP(" keyIndex : %" PRIu8, this->keyIndex);
182
- MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
183
- MS_DUMP(" hasPictureId : %s", this->hasPictureId ? "true" : "false");
184
- MS_DUMP(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false");
185
- MS_DUMP(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false");
186
- MS_DUMP(" hasTl0PictureIndex : %s", this->hasTl0PictureIndex ? "true" : "false");
187
- MS_DUMP(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
188
- MS_DUMP("</PayloadDescriptor>");
173
+ MS_DUMP(" extended: %" PRIu8, this->extended);
174
+ MS_DUMP(" nonReference: %" PRIu8, this->nonReference);
175
+ MS_DUMP(" start: %" PRIu8, this->start);
176
+ MS_DUMP(" partitionIndex: %" PRIu8, this->partitionIndex);
177
+ MS_DUMP(" pictureId: %" PRIu16, this->pictureId);
178
+ MS_DUMP(" tl0PictureIndex: %" PRIu8, this->tl0PictureIndex);
179
+ MS_DUMP(" tlIndex: %" PRIu8, this->tlIndex);
180
+ MS_DUMP(" y: %" PRIu8, this->y);
181
+ MS_DUMP(" keyIndex: %" PRIu8, this->keyIndex);
182
+ MS_DUMP(" isKeyFrame: %s", this->isKeyFrame ? "true" : "false");
183
+ MS_DUMP(" hasPictureId: %s", this->hasPictureId ? "true" : "false");
184
+ MS_DUMP(" hasOneBytePictureId: %s", this->hasOneBytePictureId ? "true" : "false");
185
+ MS_DUMP(" hasTwoBytesPictureId: %s", this->hasTwoBytesPictureId ? "true" : "false");
186
+ MS_DUMP(" hasTl0PictureIndex: %s", this->hasTl0PictureIndex ? "true" : "false");
187
+ MS_DUMP(" hasTlIndex: %s", this->hasTlIndex ? "true" : "false");
188
+ MS_DUMP("</VP8::PayloadDescriptor>");
189
189
  }
190
190
 
191
191
  void VP8::PayloadDescriptor::Encode(uint8_t* data, uint16_t pictureId, uint8_t tl0PictureIndex) const
@@ -146,7 +146,7 @@ namespace RTC
146
146
  {
147
147
  MS_TRACE();
148
148
 
149
- MS_DUMP("<PayloadDescriptor>");
149
+ MS_DUMP("<VP9::PayloadDescriptor>");
150
150
  MS_DUMP(
151
151
  " i:%" PRIu8 "|p:%" PRIu8 "|l:%" PRIu8 "|f:%" PRIu8 "|b:%" PRIu8 "|e:%" PRIu8 "|v:%" PRIu8,
152
152
  this->i,
@@ -156,20 +156,20 @@ namespace RTC
156
156
  this->b,
157
157
  this->e,
158
158
  this->v);
159
- MS_DUMP(" pictureId : %" PRIu16, this->pictureId);
160
- MS_DUMP(" slIndex : %" PRIu8, this->slIndex);
161
- MS_DUMP(" tlIndex : %" PRIu8, this->tlIndex);
162
- MS_DUMP(" tl0PictureIndex : %" PRIu8, this->tl0PictureIndex);
163
- MS_DUMP(" interLayerDependency : %" PRIu8, this->interLayerDependency);
164
- MS_DUMP(" switchingUpPoint : %" PRIu8, this->switchingUpPoint);
165
- MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
166
- MS_DUMP(" hasPictureId : %s", this->hasPictureId ? "true" : "false");
167
- MS_DUMP(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false");
168
- MS_DUMP(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false");
169
- MS_DUMP(" hasTl0PictureIndex : %s", this->hasTl0PictureIndex ? "true" : "false");
170
- MS_DUMP(" hasSlIndex : %s", this->hasSlIndex ? "true" : "false");
171
- MS_DUMP(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
172
- MS_DUMP("</PayloadDescriptor>");
159
+ MS_DUMP(" pictureId: %" PRIu16, this->pictureId);
160
+ MS_DUMP(" slIndex: %" PRIu8, this->slIndex);
161
+ MS_DUMP(" tlIndex: %" PRIu8, this->tlIndex);
162
+ MS_DUMP(" tl0PictureIndex: %" PRIu8, this->tl0PictureIndex);
163
+ MS_DUMP(" interLayerDependency: %" PRIu8, this->interLayerDependency);
164
+ MS_DUMP(" switchingUpPoint: %" PRIu8, this->switchingUpPoint);
165
+ MS_DUMP(" isKeyFrame: %s", this->isKeyFrame ? "true" : "false");
166
+ MS_DUMP(" hasPictureId: %s", this->hasPictureId ? "true" : "false");
167
+ MS_DUMP(" hasOneBytePictureId: %s", this->hasOneBytePictureId ? "true" : "false");
168
+ MS_DUMP(" hasTwoBytesPictureId: %s", this->hasTwoBytesPictureId ? "true" : "false");
169
+ MS_DUMP(" hasTl0PictureIndex: %s", this->hasTl0PictureIndex ? "true" : "false");
170
+ MS_DUMP(" hasSlIndex: %s", this->hasSlIndex ? "true" : "false");
171
+ MS_DUMP(" hasTlIndex: %s", this->hasTlIndex ? "true" : "false");
172
+ MS_DUMP("</VP9::PayloadDescriptor>");
173
173
  }
174
174
 
175
175
  VP9::PayloadDescriptorHandler::PayloadDescriptorHandler(VP9::PayloadDescriptor* payloadDescriptor)
@@ -12,23 +12,25 @@
12
12
  #include <cstdio> // std::snprintf(), std::fopen()
13
13
  #include <cstring> // std::memcpy(), std::strcmp()
14
14
 
15
- #define LOG_OPENSSL_ERROR(desc) \
16
- do \
17
- { \
18
- if (ERR_peek_error() == 0) \
19
- { \
20
- MS_ERROR("OpenSSL error [desc:'%s']", desc); \
21
- } \
22
- else \
23
- { \
24
- int64_t err; \
25
- while ((err = ERR_get_error()) != 0) \
26
- { \
27
- MS_ERROR("OpenSSL error [desc:'%s', error:'%s']", desc, ERR_error_string(err, nullptr)); \
28
- } \
29
- ERR_clear_error(); \
30
- } \
15
+ // clang-format off
16
+ #define LOG_OPENSSL_ERROR(desc) \
17
+ do \
18
+ { \
19
+ if (ERR_peek_error() == 0) \
20
+ { \
21
+ MS_ERROR("OpenSSL error [desc:'%s']", desc); \
22
+ } \
23
+ else \
24
+ { \
25
+ int64_t err; \
26
+ while ((err = ERR_get_error()) != 0) \
27
+ { \
28
+ MS_ERROR("OpenSSL error [desc:'%s', error:'%s']", desc, ERR_error_string(err, nullptr)); \
29
+ } \
30
+ ERR_clear_error(); \
31
+ } \
31
32
  } while (false)
33
+ // clang-format on
32
34
 
33
35
  /* Static methods for OpenSSL callbacks. */
34
36
 
@@ -45,15 +47,49 @@ inline static void onSslInfo(const SSL* ssl, int where, int ret)
45
47
  static_cast<RTC::DtlsTransport*>(SSL_get_ex_data(ssl, 0))->OnSslInfo(where, ret);
46
48
  }
47
49
 
50
+ /**
51
+ * This callback is called by OpenSSL when it wants to send DTLS data to the
52
+ * endpoint. Such a data could be a full DTLS message, various DTLS messages,
53
+ * a DTLS message fragment, various DTLS message fragments or a combination of
54
+ * these. It's guaranteed (by observation) that |len| argument corresponds to
55
+ * the entire content of our BIO mem buffer |this->sslBioToNetwork| and it
56
+ * never exceeds our |DtlsMtu| limit.
57
+ */
58
+ inline static long onSslBioOut(
59
+ BIO* bio,
60
+ int operationType,
61
+ const char* argp,
62
+ size_t len,
63
+ int /*argi*/,
64
+ long /*argl*/,
65
+ int ret,
66
+ size_t* /*processed*/)
67
+ {
68
+ long resultOfcallback = (operationType == BIO_CB_RETURN) ? static_cast<long>(ret) : 1;
69
+
70
+ // This callback is called twice for write operations:
71
+ // - First one with operationType = BIO_CB_WRITE.
72
+ // - Second one with operationType = BIO_CB_RETURN | BIO_CB_WRITE.
73
+ // We only care about the former.
74
+ if ((operationType == BIO_CB_WRITE) && argp && len > 0)
75
+ {
76
+ auto* dtlsTransport = reinterpret_cast<RTC::DtlsTransport*>(BIO_get_callback_arg(bio));
77
+
78
+ dtlsTransport->SendDtlsData(reinterpret_cast<const uint8_t*>(argp), len);
79
+ }
80
+
81
+ return resultOfcallback;
82
+ }
83
+
48
84
  inline static unsigned int onSslDtlsTimer(SSL* /*ssl*/, unsigned int timerUs)
49
85
  {
50
- if (timerUs == 0)
86
+ if (timerUs == 0u)
51
87
  {
52
- return 100000;
88
+ return 100000u;
53
89
  }
54
- else if (timerUs >= 4000000)
90
+ else if (timerUs >= 4000000u)
55
91
  {
56
- return 4000000;
92
+ return 4000000u;
57
93
  }
58
94
  else
59
95
  {
@@ -69,15 +105,15 @@ namespace RTC
69
105
  static constexpr int DtlsMtu{ 1350 };
70
106
  static constexpr int SslReadBufferSize{ 65536 };
71
107
  // AES-HMAC: http://tools.ietf.org/html/rfc3711
72
- static constexpr size_t SrtpMasterKeyLength{ 16 };
73
- static constexpr size_t SrtpMasterSaltLength{ 14 };
108
+ static constexpr size_t SrtpMasterKeyLength{ 16u };
109
+ static constexpr size_t SrtpMasterSaltLength{ 14u };
74
110
  static constexpr size_t SrtpMasterLength{ SrtpMasterKeyLength + SrtpMasterSaltLength };
75
111
  // AES-GCM: http://tools.ietf.org/html/rfc7714
76
- static constexpr size_t SrtpAesGcm256MasterKeyLength{ 32 };
77
- static constexpr size_t SrtpAesGcm256MasterSaltLength{ 12 };
112
+ static constexpr size_t SrtpAesGcm256MasterKeyLength{ 32u };
113
+ static constexpr size_t SrtpAesGcm256MasterSaltLength{ 12u };
78
114
  static constexpr size_t SrtpAesGcm256MasterLength{ SrtpAesGcm256MasterKeyLength + SrtpAesGcm256MasterSaltLength };
79
- static constexpr size_t SrtpAesGcm128MasterKeyLength{ 16 };
80
- static constexpr size_t SrtpAesGcm128MasterSaltLength{ 12 };
115
+ static constexpr size_t SrtpAesGcm128MasterKeyLength{ 16u };
116
+ static constexpr size_t SrtpAesGcm128MasterSaltLength{ 12u };
81
117
  static constexpr size_t SrtpAesGcm128MasterLength{ SrtpAesGcm128MasterKeyLength + SrtpAesGcm128MasterSaltLength };
82
118
  // clang-format on
83
119
 
@@ -706,15 +742,19 @@ namespace RTC
706
742
  goto error;
707
743
  }
708
744
 
709
- SSL_set_bio(this->ssl, this->sslBioFromNetwork, this->sslBioToNetwork);
710
-
711
745
  // Set the MTU so that we don't send packets that are too large with no
712
746
  // fragmentation.
713
- // TODO: This is not honored, see issue:
714
- // https://github.com/versatica/mediasoup/issues/1100
715
747
  SSL_set_mtu(this->ssl, DtlsMtu);
716
748
  DTLS_set_link_mtu(this->ssl, DtlsMtu);
717
749
 
750
+ // We want to monitor OpenSSL write operations into our |sslBioToNetwork|
751
+ // buffer so we can immediately send those DTLS bytes (containing full DTLS
752
+ // messages, or valid DTLS fragment messages, or combination of them) to
753
+ // the endpoint, and hence we honor the configured DTLS MTU.
754
+ BIO_set_callback_ex(this->sslBioToNetwork, onSslBioOut);
755
+ BIO_set_callback_arg(this->sslBioToNetwork, reinterpret_cast<char*>(this));
756
+ SSL_set_bio(this->ssl, this->sslBioFromNetwork, this->sslBioToNetwork);
757
+
718
758
  // Set callback handler for setting DTLS timer interval.
719
759
  DTLS_set_timer_cb(this->ssl, onSslDtlsTimer);
720
760
 
@@ -755,7 +795,6 @@ namespace RTC
755
795
  {
756
796
  // Send close alert to the peer.
757
797
  SSL_shutdown(this->ssl);
758
- SendPendingOutgoingDtlsData();
759
798
  }
760
799
 
761
800
  if (this->ssl)
@@ -832,9 +871,9 @@ namespace RTC
832
871
  }
833
872
 
834
873
  MS_DUMP("<DtlsTransport>");
835
- MS_DUMP(" state : %s", state.c_str());
836
- MS_DUMP(" role : %s", role.c_str());
837
- MS_DUMP(" handshake done: : %s", this->handshakeDone ? "yes" : "no");
874
+ MS_DUMP(" state: %s", state.c_str());
875
+ MS_DUMP(" role: %s", role.c_str());
876
+ MS_DUMP(" handshake done: %s", this->handshakeDone ? "yes" : "no");
838
877
  MS_DUMP("</DtlsTransport>");
839
878
  }
840
879
 
@@ -878,7 +917,6 @@ namespace RTC
878
917
 
879
918
  SSL_set_connect_state(this->ssl);
880
919
  SSL_do_handshake(this->ssl);
881
- SendPendingOutgoingDtlsData();
882
920
  SetTimeout();
883
921
 
884
922
  break;
@@ -949,9 +987,6 @@ namespace RTC
949
987
  // Must call SSL_read() to process received DTLS data.
950
988
  read = SSL_read(this->ssl, static_cast<void*>(DtlsTransport::sslReadBuffer), SslReadBufferSize);
951
989
 
952
- // Send data if it's ready.
953
- SendPendingOutgoingDtlsData();
954
-
955
990
  // Check SSL status and return if it is bad/closed.
956
991
  if (!CheckStatus(read))
957
992
  {
@@ -1020,9 +1055,31 @@ namespace RTC
1020
1055
  MS_WARN_TAG(
1021
1056
  dtls, "OpenSSL SSL_write() wrote less (%d bytes) than given data (%zu bytes)", written, len);
1022
1057
  }
1058
+ }
1059
+
1060
+ /**
1061
+ * This method is called within our |onSslBioOut| callback above. As told
1062
+ * there, it's guaranteed that OpenSSL invokes that callback with all the
1063
+ * bytes currently written in our BIO mem buffer |this->sslBioToNetwork| so
1064
+ * we can safely reset/clear that buffer once we have sent the data to the
1065
+ * endpoint.
1066
+ */
1067
+ void DtlsTransport::SendDtlsData(const uint8_t* data, size_t len)
1068
+ {
1069
+ MS_TRACE();
1070
+
1071
+ MS_DEBUG_DEV("%zu bytes of DTLS data ready to be sent", len);
1023
1072
 
1024
- // Send data.
1025
- SendPendingOutgoingDtlsData();
1073
+ // Notify the listener.
1074
+ this->listener->OnDtlsTransportSendData(this, data, len);
1075
+
1076
+ // Clear the BIO buffer.
1077
+ auto ret = BIO_reset(this->sslBioToNetwork);
1078
+
1079
+ if (ret != 1)
1080
+ {
1081
+ MS_ERROR("BIO_reset() failed [ret:%d]", ret);
1082
+ }
1026
1083
  }
1027
1084
 
1028
1085
  void DtlsTransport::Reset()
@@ -1042,8 +1099,9 @@ namespace RTC
1042
1099
  this->timer->Stop();
1043
1100
 
1044
1101
  // NOTE: We need to reset the SSL instance so we need to "shutdown" it, but
1045
- // we don't want to send a Close Alert to the peer, so just don't call
1046
- // SendPendingOutgoingDTLSData().
1102
+ // we don't want to send a DTLS Close Alert to the peer. However this is
1103
+ // gonna happen since SSL_shutdown() will trigger a DTLS Close Alert and
1104
+ // we'll have our onSslBioOut() callback called to deliver it.
1047
1105
  SSL_shutdown(this->ssl);
1048
1106
 
1049
1107
  this->localRole.reset();
@@ -1067,10 +1125,9 @@ namespace RTC
1067
1125
  {
1068
1126
  MS_TRACE();
1069
1127
 
1070
- int err;
1071
1128
  const bool wasHandshakeDone = this->handshakeDone;
1072
1129
 
1073
- err = SSL_get_error(this->ssl, returnCode);
1130
+ int err = SSL_get_error(this->ssl, returnCode);
1074
1131
 
1075
1132
  switch (err)
1076
1133
  {
@@ -1180,36 +1237,6 @@ namespace RTC
1180
1237
  }
1181
1238
  }
1182
1239
 
1183
- void DtlsTransport::SendPendingOutgoingDtlsData()
1184
- {
1185
- MS_TRACE();
1186
-
1187
- if (BIO_eof(this->sslBioToNetwork))
1188
- {
1189
- return;
1190
- }
1191
-
1192
- int64_t read;
1193
- char* data{ nullptr };
1194
-
1195
- read = BIO_get_mem_data(this->sslBioToNetwork, &data); // NOLINT
1196
-
1197
- if (read <= 0)
1198
- {
1199
- return;
1200
- }
1201
-
1202
- MS_DEBUG_DEV("%" PRIu64 " bytes of DTLS data ready to sent to the peer", read);
1203
-
1204
- // Notify the listener.
1205
- this->listener->OnDtlsTransportSendData(
1206
- this, reinterpret_cast<uint8_t*>(data), static_cast<size_t>(read));
1207
-
1208
- // Clear the BIO buffer.
1209
- // NOTE: the (void) avoids the -Wunused-value warning.
1210
- (void)BIO_reset(this->sslBioToNetwork);
1211
- }
1212
-
1213
1240
  bool DtlsTransport::SetTimeout()
1214
1241
  {
1215
1242
  MS_TRACE();
@@ -1682,9 +1709,6 @@ namespace RTC
1682
1709
 
1683
1710
  if (ret == 1)
1684
1711
  {
1685
- // If required, send DTLS data.
1686
- SendPendingOutgoingDtlsData();
1687
-
1688
1712
  // Set the DTLS timer again.
1689
1713
  SetTimeout();
1690
1714
  }
@@ -94,11 +94,11 @@ namespace RTC
94
94
  MS_DUMP("<ByePacket>");
95
95
  for (auto ssrc : this->ssrcs)
96
96
  {
97
- MS_DUMP(" ssrc : %" PRIu32, ssrc);
97
+ MS_DUMP(" ssrc: %" PRIu32, ssrc);
98
98
  }
99
99
  if (!this->reason.empty())
100
100
  {
101
- MS_DUMP(" reason : %s", this->reason.c_str());
101
+ MS_DUMP(" reason: %s", this->reason.c_str());
102
102
  }
103
103
  MS_DUMP("</ByePacket>");
104
104
  }
@@ -87,9 +87,9 @@ namespace RTC
87
87
  {
88
88
  MS_TRACE();
89
89
 
90
- MS_DUMP(" sender ssrc : %" PRIu32, GetSenderSsrc());
91
- MS_DUMP(" media ssrc : %" PRIu32, GetMediaSsrc());
92
- MS_DUMP(" size : %zu", this->GetSize());
90
+ MS_DUMP(" sender ssrc: %" PRIu32, GetSenderSsrc());
91
+ MS_DUMP(" media ssrc: %" PRIu32, GetMediaSsrc());
92
+ MS_DUMP(" size: %zu", this->GetSize());
93
93
  }
94
94
 
95
95
  /* Specialization for Ps class. */
@@ -41,8 +41,8 @@ namespace RTC
41
41
  MS_TRACE();
42
42
 
43
43
  MS_DUMP("<FeedbackPsFirItem>");
44
- MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
45
- MS_DUMP(" sequence number : %" PRIu8, this->GetSequenceNumber());
44
+ MS_DUMP(" ssrc: %" PRIu32, this->GetSsrc());
45
+ MS_DUMP(" sequence number: %" PRIu8, this->GetSequenceNumber());
46
46
  MS_DUMP("</FeedbackPsFirItem>");
47
47
  }
48
48
  } // namespace RTCP
@@ -34,7 +34,7 @@ namespace RTC
34
34
  MS_TRACE();
35
35
 
36
36
  MS_DUMP("<FeedbackPsLeiItem>");
37
- MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
37
+ MS_DUMP(" ssrc: %" PRIu32, this->GetSsrc());
38
38
  MS_DUMP("</FeedbackPsLeiItem>");
39
39
  }
40
40
  } // namespace RTCP
@@ -147,10 +147,10 @@ namespace RTC
147
147
 
148
148
  MS_DUMP("<FeedbackPsRembPacket>");
149
149
  FeedbackPsPacket::Dump();
150
- MS_DUMP(" bitrate (bps) : %" PRIu64, this->bitrate);
150
+ MS_DUMP(" bitrate (bps): %" PRIu64, this->bitrate);
151
151
  for (auto ssrc : this->ssrcs)
152
152
  {
153
- MS_DUMP(" ssrc : %" PRIu32, ssrc);
153
+ MS_DUMP(" ssrc: %" PRIu32, ssrc);
154
154
  }
155
155
  MS_DUMP("</FeedbackPsRembPacket>");
156
156
  }
@@ -77,9 +77,9 @@ namespace RTC
77
77
  MS_TRACE();
78
78
 
79
79
  MS_DUMP("<FeedbackPsRpsiItem>");
80
- MS_DUMP(" padding bits : %" PRIu8, this->header->paddingBits);
81
- MS_DUMP(" payload type : %" PRIu8, this->GetPayloadType());
82
- MS_DUMP(" length : %zu", this->GetLength());
80
+ MS_DUMP(" padding bits %" PRIu8, this->header->paddingBits);
81
+ MS_DUMP(" payload type: %" PRIu8, this->GetPayloadType());
82
+ MS_DUMP(" length: %zu", this->GetLength());
83
83
  MS_DUMP("</FeedbackPsRpsiItem>");
84
84
  }
85
85
  } // namespace RTCP
@@ -39,9 +39,9 @@ namespace RTC
39
39
  MS_TRACE();
40
40
 
41
41
  MS_DUMP("<FeedbackPsSliItem>");
42
- MS_DUMP(" first : %" PRIu16, this->first);
43
- MS_DUMP(" number : %" PRIu16, this->number);
44
- MS_DUMP(" picture id : %" PRIu8, this->pictureId);
42
+ MS_DUMP(" first: %" PRIu16, this->first);
43
+ MS_DUMP(" number: %" PRIu16, this->number);
44
+ MS_DUMP(" picture id: %" PRIu8, this->pictureId);
45
45
  MS_DUMP("</FeedbackPsSliItem>");
46
46
  }
47
47
  } // namespace RTCP
@@ -41,9 +41,9 @@ namespace RTC
41
41
  MS_TRACE();
42
42
 
43
43
  MS_DUMP("<FeedbackPsTstItem>");
44
- MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
45
- MS_DUMP(" sequence number : %" PRIu32, this->GetSequenceNumber());
46
- MS_DUMP(" index : %" PRIu32, this->GetIndex());
44
+ MS_DUMP(" ssrc: %" PRIu32, this->GetSsrc());
45
+ MS_DUMP(" sequence number: %" PRIu32, this->GetSequenceNumber());
46
+ MS_DUMP(" index: %" PRIu32, this->GetIndex());
47
47
  MS_DUMP("</FeedbackPsTstItem>");
48
48
  }
49
49
 
@@ -51,10 +51,10 @@ namespace RTC
51
51
  MS_TRACE();
52
52
 
53
53
  MS_DUMP("<FeedbackPsVbcmItem>");
54
- MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
55
- MS_DUMP(" sequence number : %" PRIu8, this->GetSequenceNumber());
56
- MS_DUMP(" payload type : %" PRIu8, this->GetPayloadType());
57
- MS_DUMP(" length : %" PRIu16, this->GetLength());
54
+ MS_DUMP(" ssrc: %" PRIu32, this->GetSsrc());
55
+ MS_DUMP(" sequence number: %" PRIu8, this->GetSequenceNumber());
56
+ MS_DUMP(" payload type: %" PRIu8, this->GetPayloadType());
57
+ MS_DUMP(" length: %" PRIu16, this->GetLength());
58
58
  MS_DUMP("</FeedbackPsVbcmItem>");
59
59
  }
60
60
  } // namespace RTCP
@@ -24,13 +24,13 @@ namespace RTC
24
24
  MS_TRACE();
25
25
 
26
26
  MS_DUMP("<FeedbackRtpEcnItem>");
27
- MS_DUMP(" sequence number : %" PRIu32, this->GetSequenceNumber());
28
- MS_DUMP(" ect0 counter : %" PRIu32, this->GetEct0Counter());
29
- MS_DUMP(" ect1 counter : %" PRIu32, this->GetEct1Counter());
30
- MS_DUMP(" ecn ce counter : %" PRIu16, this->GetEcnCeCounter());
31
- MS_DUMP(" not ect counter : %" PRIu16, this->GetNotEctCounter());
32
- MS_DUMP(" lost packets : %" PRIu16, this->GetLostPackets());
33
- MS_DUMP(" duplicated packets : %" PRIu16, this->GetDuplicatedPackets());
27
+ MS_DUMP(" sequence number: %" PRIu32, this->GetSequenceNumber());
28
+ MS_DUMP(" ect0 counter: %" PRIu32, this->GetEct0Counter());
29
+ MS_DUMP(" ect1 counter: %" PRIu32, this->GetEct1Counter());
30
+ MS_DUMP(" ecn ce counter: %" PRIu16, this->GetEcnCeCounter());
31
+ MS_DUMP(" not ect counter: %" PRIu16, this->GetNotEctCounter());
32
+ MS_DUMP(" lost packets: %" PRIu16, this->GetLostPackets());
33
+ MS_DUMP(" duplicated packets: %" PRIu16, this->GetDuplicatedPackets());
34
34
  MS_DUMP("</FeedbackRtpEcnItem>");
35
35
  }
36
36
  } // namespace RTCP
@@ -37,8 +37,8 @@ namespace RTC
37
37
  std::bitset<16> nackBitset(this->GetLostPacketBitmask());
38
38
 
39
39
  MS_DUMP("<FeedbackRtpNackItem>");
40
- MS_DUMP(" pid : %" PRIu16, this->GetPacketId());
41
- MS_DUMP(" bpl : %s", nackBitset.to_string().c_str());
40
+ MS_DUMP(" pid: %" PRIu16, this->GetPacketId());
41
+ MS_DUMP(" bpl: %s", nackBitset.to_string().c_str());
42
42
  MS_DUMP("</FeedbackRtpNackItem>");
43
43
  }
44
44
  } // namespace RTCP
@@ -68,9 +68,9 @@ namespace RTC
68
68
  MS_TRACE();
69
69
 
70
70
  MS_DUMP("<FeedbackRtpTmmbItem>");
71
- MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
72
- MS_DUMP(" bitrate : %" PRIu64, this->GetBitrate());
73
- MS_DUMP(" overhead : %" PRIu16, this->GetOverhead());
71
+ MS_DUMP(" ssrc: %" PRIu32, this->GetSsrc());
72
+ MS_DUMP(" bitrate: %" PRIu64, this->GetBitrate());
73
+ MS_DUMP(" overhead: %" PRIu16, this->GetOverhead());
74
74
  MS_DUMP("</FeedbackRtpTmmbItem>");
75
75
  }
76
76
 
@@ -179,11 +179,11 @@ namespace RTC
179
179
  MS_TRACE();
180
180
 
181
181
  MS_DUMP("<FeedbackRtpTransportPacket>");
182
- MS_DUMP(" base sequence : %" PRIu16, this->baseSequenceNumber);
183
- MS_DUMP(" packet status count : %" PRIu16, this->packetStatusCount);
184
- MS_DUMP(" reference time : %" PRIi32, this->referenceTime);
185
- MS_DUMP(" feedback packet count : %" PRIu8, this->feedbackPacketCount);
186
- MS_DUMP(" size : %zu", GetSize());
182
+ MS_DUMP(" base sequence: %" PRIu16, this->baseSequenceNumber);
183
+ MS_DUMP(" packet status count: %" PRIu16, this->packetStatusCount);
184
+ MS_DUMP(" reference time: %" PRIi32, this->referenceTime);
185
+ MS_DUMP(" feedback packet count: %" PRIu8, this->feedbackPacketCount);
186
+ MS_DUMP(" size: %zu", GetSize());
187
187
 
188
188
  for (auto* chunk : this->chunks)
189
189
  {
@@ -728,8 +728,8 @@ namespace RTC
728
728
  MS_TRACE();
729
729
 
730
730
  MS_DUMP(" <RunLengthChunk>");
731
- MS_DUMP(" status : %s", FeedbackRtpTransportPacket::status2String[this->status].c_str());
732
- MS_DUMP(" count : %" PRIu16, this->count);
731
+ MS_DUMP(" status: %s", FeedbackRtpTransportPacket::status2String[this->status].c_str());
732
+ MS_DUMP(" count: %" PRIu16, this->count);
733
733
  MS_DUMP(" </RunLengthChunk>");
734
734
  }
735
735
 
@@ -37,13 +37,13 @@ namespace RTC
37
37
  MS_TRACE();
38
38
 
39
39
  MS_DUMP("<ReceiverReport>");
40
- MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
41
- MS_DUMP(" fraction lost : %" PRIu8, GetFractionLost());
42
- MS_DUMP(" total lost : %" PRIu32, GetTotalLost());
43
- MS_DUMP(" last seq : %" PRIu32, GetLastSeq());
44
- MS_DUMP(" jitter : %" PRIu32, GetJitter());
45
- MS_DUMP(" lsr : %" PRIu32, GetLastSenderReport());
46
- MS_DUMP(" dlsr : %" PRIu32, GetDelaySinceLastSenderReport());
40
+ MS_DUMP(" ssrc: %" PRIu32, GetSsrc());
41
+ MS_DUMP(" fraction lost: %" PRIu8, GetFractionLost());
42
+ MS_DUMP(" total lost: %" PRIu32, GetTotalLost());
43
+ MS_DUMP(" last seq: %" PRIu32, GetLastSeq());
44
+ MS_DUMP(" jitter: %" PRIu32, GetJitter());
45
+ MS_DUMP(" lsr: %" PRIu32, GetLastSenderReport());
46
+ MS_DUMP(" dlsr: %" PRIu32, GetDelaySinceLastSenderReport());
47
47
  MS_DUMP("</ReceiverReport>");
48
48
  }
49
49
 
@@ -92,9 +92,9 @@ namespace RTC
92
92
  MS_TRACE();
93
93
 
94
94
  MS_DUMP("<SdesItem>");
95
- MS_DUMP(" type : %s", SdesItem::Type2String(this->GetType()).c_str());
96
- MS_DUMP(" length : %" PRIu8, this->header->length);
97
- MS_DUMP(" value : %.*s", this->header->length, this->header->value);
95
+ MS_DUMP(" type: %s", SdesItem::Type2String(this->GetType()).c_str());
96
+ MS_DUMP(" length: %" PRIu8, this->header->length);
97
+ MS_DUMP(" value: %.*s", this->header->length, this->header->value);
98
98
  MS_DUMP("</SdesItem>");
99
99
  }
100
100
 
@@ -240,7 +240,7 @@ namespace RTC
240
240
  MS_TRACE();
241
241
 
242
242
  MS_DUMP("<SdesChunk>");
243
- MS_DUMP(" ssrc : %" PRIu32, this->ssrc);
243
+ MS_DUMP(" ssrc: %" PRIu32, this->ssrc);
244
244
  for (auto* item : this->items)
245
245
  {
246
246
  item->Dump();
@@ -36,12 +36,12 @@ namespace RTC
36
36
  MS_TRACE();
37
37
 
38
38
  MS_DUMP("<SenderReport>");
39
- MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
40
- MS_DUMP(" ntp sec : %" PRIu32, GetNtpSec());
41
- MS_DUMP(" ntp frac : %" PRIu32, GetNtpFrac());
42
- MS_DUMP(" rtp ts : %" PRIu32, GetRtpTs());
43
- MS_DUMP(" packet count : %" PRIu32, GetPacketCount());
44
- MS_DUMP(" octet count : %" PRIu32, GetOctetCount());
39
+ MS_DUMP(" ssrc: %" PRIu32, GetSsrc());
40
+ MS_DUMP(" ntp sec: %" PRIu32, GetNtpSec());
41
+ MS_DUMP(" ntp frac: %" PRIu32, GetNtpFrac());
42
+ MS_DUMP(" rtp ts: %" PRIu32, GetRtpTs());
43
+ MS_DUMP(" packet count: %" PRIu32, GetPacketCount());
44
+ MS_DUMP(" octet count: %" PRIu32, GetOctetCount());
45
45
  MS_DUMP("</SenderReport>");
46
46
  }
47
47
 
@@ -38,9 +38,9 @@ namespace RTC
38
38
  MS_TRACE();
39
39
 
40
40
  MS_DUMP(" <SsrcInfo>");
41
- MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
42
- MS_DUMP(" lrr : %" PRIu32, GetLastReceiverReport());
43
- MS_DUMP(" dlrr : %" PRIu32, GetDelaySinceLastReceiverReport());
41
+ MS_DUMP(" ssrc: %" PRIu32, GetSsrc());
42
+ MS_DUMP(" lrr: %" PRIu32, GetLastReceiverReport());
43
+ MS_DUMP(" dlrr: %" PRIu32, GetDelaySinceLastReceiverReport());
44
44
  MS_DUMP(" <SsrcInfo>");
45
45
  }
46
46
 
@@ -117,10 +117,10 @@ namespace RTC
117
117
  MS_TRACE();
118
118
 
119
119
  MS_DUMP("<DelaySinceLastRr>");
120
- MS_DUMP(" block type : %" PRIu8, (uint8_t)this->type);
121
- MS_DUMP(" reserved : 0");
120
+ MS_DUMP(" block type: %" PRIu8, (uint8_t)this->type);
121
+ MS_DUMP(" reserved: 0");
122
122
  MS_DUMP(
123
- " length : %" PRIu16,
123
+ " length: %" PRIu16,
124
124
  static_cast<uint16_t>((SsrcInfo::BodySize * this->ssrcInfos.size() / 4)));
125
125
  for (auto* ssrcInfo : this->ssrcInfos)
126
126
  {
@@ -35,11 +35,11 @@ namespace RTC
35
35
  MS_TRACE();
36
36
 
37
37
  MS_DUMP("<ReceiverReferenceTime>");
38
- MS_DUMP(" block type : %" PRIu8, static_cast<uint8_t>(this->type));
39
- MS_DUMP(" reserved : 0");
40
- MS_DUMP(" length : 2");
41
- MS_DUMP(" ntp sec : %" PRIu32, GetNtpSec());
42
- MS_DUMP(" ntp frac : %" PRIu32, GetNtpFrac());
38
+ MS_DUMP(" block type: %" PRIu8, static_cast<uint8_t>(this->type));
39
+ MS_DUMP(" reserved: 0");
40
+ MS_DUMP(" length: 2");
41
+ MS_DUMP(" ntp sec: %" PRIu32, GetNtpSec());
42
+ MS_DUMP(" ntp frac: %" PRIu32, GetNtpFrac());
43
43
  MS_DUMP("</ReceiverReferenceTime>");
44
44
  }
45
45
 
@@ -166,21 +166,21 @@ namespace RTC
166
166
  MS_TRACE();
167
167
 
168
168
  MS_DUMP("<RtpPacket>");
169
- MS_DUMP(" padding : %s", this->header->padding ? "true" : "false");
169
+ MS_DUMP(" padding: %s", this->header->padding ? "true" : "false");
170
170
  if (HasHeaderExtension())
171
171
  {
172
172
  MS_DUMP(
173
- " header extension : id:%" PRIu16 ", length:%zu",
173
+ " header extension: id:%" PRIu16 ", length:%zu",
174
174
  GetHeaderExtensionId(),
175
175
  GetHeaderExtensionLength());
176
176
  }
177
177
  if (HasOneByteExtensions())
178
178
  {
179
- MS_DUMP(" RFC5285 ext style : One-Byte Header");
179
+ MS_DUMP(" RFC5285 ext style: One-Byte Header");
180
180
  }
181
181
  if (HasTwoBytesExtensions())
182
182
  {
183
- MS_DUMP(" RFC5285 ext style : Two-Bytes Header");
183
+ MS_DUMP(" RFC5285 ext style: Two-Bytes Header");
184
184
  }
185
185
  if (HasOneByteExtensions() || HasTwoBytesExtensions())
186
186
  {
@@ -213,7 +213,7 @@ namespace RTC
213
213
  extIds.begin(), extIds.end() - 1, std::ostream_iterator<std::string>(extIdsStream, ","));
214
214
  extIdsStream << extIds.back();
215
215
 
216
- MS_DUMP(" RFC5285 ext ids : %s", extIdsStream.str().c_str());
216
+ MS_DUMP(" RFC5285 ext ids: %s", extIdsStream.str().c_str());
217
217
  }
218
218
  }
219
219
  if (this->midExtensionId != 0u)
@@ -222,8 +222,7 @@ namespace RTC
222
222
 
223
223
  if (ReadMid(mid))
224
224
  {
225
- MS_DUMP(
226
- " mid : extId:%" PRIu8 ", value:'%s'", this->midExtensionId, mid.c_str());
225
+ MS_DUMP(" mid: extId:%" PRIu8 ", value:'%s'", this->midExtensionId, mid.c_str());
227
226
  }
228
227
  }
229
228
  if (this->ridExtensionId != 0u)
@@ -232,8 +231,7 @@ namespace RTC
232
231
 
233
232
  if (ReadRid(rid))
234
233
  {
235
- MS_DUMP(
236
- " rid : extId:%" PRIu8 ", value:'%s'", this->ridExtensionId, rid.c_str());
234
+ MS_DUMP(" rid: extId:%" PRIu8 ", value:'%s'", this->ridExtensionId, rid.c_str());
237
235
  }
238
236
  }
239
237
  if (this->rridExtensionId != 0u)
@@ -242,13 +240,12 @@ namespace RTC
242
240
 
243
241
  if (ReadRid(rid))
244
242
  {
245
- MS_DUMP(
246
- " rrid : extId:%" PRIu8 ", value:'%s'", this->rridExtensionId, rid.c_str());
243
+ MS_DUMP(" rrid: extId:%" PRIu8 ", value:'%s'", this->rridExtensionId, rid.c_str());
247
244
  }
248
245
  }
249
246
  if (this->absSendTimeExtensionId != 0u)
250
247
  {
251
- MS_DUMP(" absSendTime : extId:%" PRIu8, this->absSendTimeExtensionId);
248
+ MS_DUMP(" absSendTime: extId:%" PRIu8, this->absSendTimeExtensionId);
252
249
  }
253
250
  if (this->transportWideCc01ExtensionId != 0u)
254
251
  {
@@ -257,7 +254,7 @@ namespace RTC
257
254
  if (ReadTransportWideCc01(wideSeqNumber))
258
255
  {
259
256
  MS_DUMP(
260
- " transportWideCc01 : extId:%" PRIu8 ", value:%" PRIu16,
257
+ " transportWideCc01: extId:%" PRIu8 ", value:%" PRIu16,
261
258
  this->transportWideCc01ExtensionId,
262
259
  wideSeqNumber);
263
260
  }
@@ -265,11 +262,11 @@ namespace RTC
265
262
  // Remove once it becomes RFC.
266
263
  if (this->frameMarking07ExtensionId != 0u)
267
264
  {
268
- MS_DUMP(" frameMarking07 : extId:%" PRIu8, this->frameMarking07ExtensionId);
265
+ MS_DUMP(" frameMarking07: extId:%" PRIu8, this->frameMarking07ExtensionId);
269
266
  }
270
267
  if (this->frameMarkingExtensionId != 0u)
271
268
  {
272
- MS_DUMP(" frameMarking : extId:%" PRIu8, this->frameMarkingExtensionId);
269
+ MS_DUMP(" frameMarking: extId:%" PRIu8, this->frameMarkingExtensionId);
273
270
  }
274
271
  if (this->ssrcAudioLevelExtensionId != 0u)
275
272
  {
@@ -279,7 +276,7 @@ namespace RTC
279
276
  if (ReadSsrcAudioLevel(volume, voice))
280
277
  {
281
278
  MS_DUMP(
282
- " ssrcAudioLevel : extId:%" PRIu8 ", volume:%" PRIu8 ", voice:%s",
279
+ " ssrcAudioLevel: extId:%" PRIu8 ", volume:%" PRIu8 ", voice:%s",
283
280
  this->ssrcAudioLevelExtensionId,
284
281
  volume,
285
282
  voice ? "true" : "false");
@@ -294,27 +291,27 @@ namespace RTC
294
291
  if (ReadVideoOrientation(camera, flip, rotation))
295
292
  {
296
293
  MS_DUMP(
297
- " videoOrientation : extId:%" PRIu8 ", camera:%s, flip:%s, rotation:%" PRIu16,
294
+ " videoOrientation: extId:%" PRIu8 ", camera:%s, flip:%s, rotation:%" PRIu16,
298
295
  this->videoOrientationExtensionId,
299
296
  camera ? "true" : "false",
300
297
  flip ? "true" : "false",
301
298
  rotation);
302
299
  }
303
300
  }
304
- MS_DUMP(" csrc count : %" PRIu8, this->header->csrcCount);
305
- MS_DUMP(" marker : %s", HasMarker() ? "true" : "false");
306
- MS_DUMP(" payload type : %" PRIu8, GetPayloadType());
307
- MS_DUMP(" sequence number : %" PRIu16, GetSequenceNumber());
308
- MS_DUMP(" timestamp : %" PRIu32, GetTimestamp());
309
- MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
310
- MS_DUMP(" payload size : %zu bytes", GetPayloadLength());
301
+ MS_DUMP(" csrc count: %" PRIu8, this->header->csrcCount);
302
+ MS_DUMP(" marker: %s", HasMarker() ? "true" : "false");
303
+ MS_DUMP(" payload type: %" PRIu8, GetPayloadType());
304
+ MS_DUMP(" sequence number: %" PRIu16, GetSequenceNumber());
305
+ MS_DUMP(" timestamp: %" PRIu32, GetTimestamp());
306
+ MS_DUMP(" ssrc: %" PRIu32, GetSsrc());
307
+ MS_DUMP(" payload size: %zu bytes", GetPayloadLength());
311
308
  if (this->header->padding != 0u)
312
309
  {
313
- MS_DUMP(" padding size : %" PRIu8 " bytes", this->payloadPadding);
310
+ MS_DUMP(" padding size: %" PRIu8 " bytes", this->payloadPadding);
314
311
  }
315
- MS_DUMP(" packet size : %zu bytes", GetSize());
316
- MS_DUMP(" spatial layer : %" PRIu8, GetSpatialLayer());
317
- MS_DUMP(" temporal layer : %" PRIu8, GetTemporalLayer());
312
+ MS_DUMP(" packet size: %zu bytes", GetSize());
313
+ MS_DUMP(" spatial layer: %" PRIu8, GetSpatialLayer());
314
+ MS_DUMP(" temporal layer: %" PRIu8, GetTemporalLayer());
318
315
  MS_DUMP("</RtpPacket>");
319
316
  }
320
317
 
@@ -421,7 +421,7 @@ namespace RTC
421
421
  }
422
422
  if (this->hasUseCandidate)
423
423
  {
424
- MS_DUMP(" useCandidate");
424
+ MS_DUMP(" useCandidate: yes");
425
425
  }
426
426
  if (!this->software.empty())
427
427
  {
@@ -450,7 +450,7 @@ namespace RTC
450
450
  }
451
451
  if (this->hasFingerprint)
452
452
  {
453
- MS_DUMP(" has fingerprint");
453
+ MS_DUMP(" fingerprint: yes");
454
454
  }
455
455
 
456
456
  MS_DUMP("</StunPacket>");
@@ -74,22 +74,22 @@ namespace RTC
74
74
 
75
75
  Utils::IP::GetAddressInfo(GetLocalAddress(), family, ip, port);
76
76
 
77
- MS_DUMP(" localIp : %s", ip.c_str());
78
- MS_DUMP(" localPort : %" PRIu16, port);
77
+ MS_DUMP(" localIp: %s", ip.c_str());
78
+ MS_DUMP(" localPort: %" PRIu16, port);
79
79
 
80
80
  Utils::IP::GetAddressInfo(GetRemoteAddress(), family, ip, port);
81
81
 
82
- MS_DUMP(" remoteIp : %s", ip.c_str());
83
- MS_DUMP(" remotePort : %" PRIu16, port);
82
+ MS_DUMP(" remoteIp: %s", ip.c_str());
83
+ MS_DUMP(" remotePort: %" PRIu16, port);
84
84
 
85
85
  switch (GetProtocol())
86
86
  {
87
87
  case Protocol::UDP:
88
- MS_DUMP(" protocol : udp");
88
+ MS_DUMP(" protocol: udp");
89
89
  break;
90
90
 
91
91
  case Protocol::TCP:
92
- MS_DUMP(" protocol : tcp");
92
+ MS_DUMP(" protocol: tcp");
93
93
  break;
94
94
  }
95
95
 
@@ -273,23 +273,20 @@ void Settings::PrintConfiguration()
273
273
  MS_DEBUG_TAG(info, "<configuration>");
274
274
 
275
275
  MS_DEBUG_TAG(
276
- info,
277
- " logLevel : %s",
278
- Settings::LogLevel2String[Settings::configuration.logLevel].c_str());
279
- MS_DEBUG_TAG(info, " logTags : %s", logTagsStream.str().c_str());
280
- MS_DEBUG_TAG(info, " rtcMinPort : %" PRIu16, Settings::configuration.rtcMinPort);
281
- MS_DEBUG_TAG(info, " rtcMaxPort : %" PRIu16, Settings::configuration.rtcMaxPort);
276
+ info, " logLevel: %s", Settings::LogLevel2String[Settings::configuration.logLevel].c_str());
277
+ MS_DEBUG_TAG(info, " logTags: %s", logTagsStream.str().c_str());
278
+ MS_DEBUG_TAG(info, " rtcMinPort: %" PRIu16, Settings::configuration.rtcMinPort);
279
+ MS_DEBUG_TAG(info, " rtcMaxPort: %" PRIu16, Settings::configuration.rtcMaxPort);
282
280
  if (!Settings::configuration.dtlsCertificateFile.empty())
283
281
  {
284
282
  MS_DEBUG_TAG(
285
- info, " dtlsCertificateFile : %s", Settings::configuration.dtlsCertificateFile.c_str());
286
- MS_DEBUG_TAG(
287
- info, " dtlsPrivateKeyFile : %s", Settings::configuration.dtlsPrivateKeyFile.c_str());
283
+ info, " dtlsCertificateFile: %s", Settings::configuration.dtlsCertificateFile.c_str());
284
+ MS_DEBUG_TAG(info, " dtlsPrivateKeyFile: %s", Settings::configuration.dtlsPrivateKeyFile.c_str());
288
285
  }
289
286
  if (!Settings::configuration.libwebrtcFieldTrials.empty())
290
287
  {
291
288
  MS_DEBUG_TAG(
292
- info, " libwebrtcFieldTrials : %s", Settings::configuration.libwebrtcFieldTrials.c_str());
289
+ info, " libwebrtcFieldTrials: %s", Settings::configuration.libwebrtcFieldTrials.c_str());
293
290
  }
294
291
 
295
292
  MS_DEBUG_TAG(info, "</configuration>");
@@ -145,11 +145,11 @@ void TcpConnectionHandle::Close()
145
145
  void TcpConnectionHandle::Dump() const
146
146
  {
147
147
  MS_DUMP("<TcpConnectionHandle>");
148
- MS_DUMP(" localIp : %s", this->localIp.c_str());
149
- MS_DUMP(" localPort : %" PRIu16, static_cast<uint16_t>(this->localPort));
150
- MS_DUMP(" remoteIp : %s", this->peerIp.c_str());
151
- MS_DUMP(" remotePort : %" PRIu16, static_cast<uint16_t>(this->peerPort));
152
- MS_DUMP(" closed : %s", !this->closed ? "open" : "closed");
148
+ MS_DUMP(" localIp: %s", this->localIp.c_str());
149
+ MS_DUMP(" localPort: %" PRIu16, static_cast<uint16_t>(this->localPort));
150
+ MS_DUMP(" remoteIp: %s", this->peerIp.c_str());
151
+ MS_DUMP(" remotePort: %" PRIu16, static_cast<uint16_t>(this->peerPort));
152
+ MS_DUMP(" closed: %s", this->closed ? "yes" : "no");
153
153
  MS_DUMP("</TcpConnectionHandle>");
154
154
  }
155
155
 
@@ -96,12 +96,10 @@ void TcpServerHandle::Close()
96
96
  void TcpServerHandle::Dump() const
97
97
  {
98
98
  MS_DUMP("<TcpServerHandle>");
99
- MS_DUMP(
100
- " [TCP, local:%s :%" PRIu16 ", status:%s, connections:%zu]",
101
- this->localIp.c_str(),
102
- static_cast<uint16_t>(this->localPort),
103
- (!this->closed) ? "open" : "closed",
104
- this->connections.size());
99
+ MS_DUMP(" localIp: %s", this->localIp.c_str());
100
+ MS_DUMP(" localPort: %" PRIu16, static_cast<uint16_t>(this->localPort));
101
+ MS_DUMP(" num connections: %zu", this->connections.size());
102
+ MS_DUMP(" closed: %s", this->closed ? "yes" : "no");
105
103
  MS_DUMP("</TcpServerHandle>");
106
104
  }
107
105
 
@@ -135,9 +135,9 @@ void UdpSocketHandle::Close()
135
135
  void UdpSocketHandle::Dump() const
136
136
  {
137
137
  MS_DUMP("<UdpSocketHandle>");
138
- MS_DUMP(" localIp : %s", this->localIp.c_str());
139
- MS_DUMP(" localPort : %" PRIu16, static_cast<uint16_t>(this->localPort));
140
- MS_DUMP(" closed : %s", !this->closed ? "open" : "closed");
138
+ MS_DUMP(" localIp: %s", this->localIp.c_str());
139
+ MS_DUMP(" localPort: %" PRIu16, static_cast<uint16_t>(this->localPort));
140
+ MS_DUMP(" closed: %s", this->closed ? "yes" : "no");
141
141
  MS_DUMP("</UdpSocketHandle>");
142
142
  }
143
143