mediasoup 3.26.0 → 3.27.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 (322) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/node/lib/DataConsumer.js +1 -1
  3. package/node/lib/Router.js +1 -1
  4. package/node/lib/Transport.js +15 -15
  5. package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts +2 -6
  6. package/node/lib/fbs/rtp-parameters/encoding-mapping.d.ts.map +1 -1
  7. package/node/lib/fbs/rtp-parameters/encoding-mapping.js +7 -19
  8. package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.d.ts +4 -4
  9. package/node/lib/fbs/rtp-parameters/rtp-encoding-parameters.js +2 -2
  10. package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts +5 -5
  11. package/node/lib/fbs/rtp-stream/bitrate-by-layer.d.ts.map +1 -1
  12. package/node/lib/fbs/rtp-stream/bitrate-by-layer.js +3 -3
  13. package/node/lib/fbs/rtp-stream/recv-stats.d.ts +5 -5
  14. package/node/lib/fbs/rtp-stream/recv-stats.d.ts.map +1 -1
  15. package/node/lib/fbs/rtp-stream/recv-stats.js +3 -3
  16. package/node/lib/fbs/rtp-stream/send-stats.d.ts +5 -5
  17. package/node/lib/fbs/rtp-stream/send-stats.d.ts.map +1 -1
  18. package/node/lib/fbs/rtp-stream/send-stats.js +3 -3
  19. package/node/lib/fbs/transport/bwe-trace-info.d.ts +23 -23
  20. package/node/lib/fbs/transport/bwe-trace-info.d.ts.map +1 -1
  21. package/node/lib/fbs/transport/bwe-trace-info.js +15 -15
  22. package/node/lib/fbs/transport/options.d.ts +5 -5
  23. package/node/lib/fbs/transport/options.js +2 -2
  24. package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts +5 -5
  25. package/node/lib/fbs/transport/set-max-incoming-bitrate-request.d.ts.map +1 -1
  26. package/node/lib/fbs/transport/set-max-incoming-bitrate-request.js +3 -3
  27. package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts +5 -5
  28. package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.d.ts.map +1 -1
  29. package/node/lib/fbs/transport/set-max-outgoing-bitrate-request.js +3 -3
  30. package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts +5 -5
  31. package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.d.ts.map +1 -1
  32. package/node/lib/fbs/transport/set-min-outgoing-bitrate-request.js +3 -3
  33. package/node/lib/fbs/transport/stats.d.ts +38 -38
  34. package/node/lib/fbs/transport/stats.d.ts.map +1 -1
  35. package/node/lib/fbs/transport/stats.js +25 -25
  36. package/node/lib/ortc.d.ts +0 -1
  37. package/node/lib/ortc.d.ts.map +1 -1
  38. package/node/lib/ortc.js +1 -2
  39. package/node/lib/rtpParametersFbsUtils.d.ts.map +1 -1
  40. package/node/lib/rtpParametersFbsUtils.js +2 -2
  41. package/package.json +9 -9
  42. package/worker/deps/libwebrtc/libwebrtc/call/rtp_transport_controller_send.cc +10 -10
  43. package/worker/deps/libwebrtc/libwebrtc/mediasoup_helpers.h +6 -6
  44. package/worker/deps/libwebrtc/libwebrtc/modules/congestion_controller/goog_cc/alr_detector.cc +1 -1
  45. package/worker/deps/libwebrtc/libwebrtc/modules/pacing/paced_sender.cc +7 -7
  46. package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h +1 -1
  47. package/worker/deps/libwebrtc/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +1 -1
  48. package/worker/fbs/FBS/meson.build +25 -0
  49. package/worker/fbs/meson.build +15 -18
  50. package/worker/fbs/rtpParameters.fbs +1 -2
  51. package/worker/fbs/rtpStream.fbs +3 -3
  52. package/worker/fbs/transport.fbs +23 -23
  53. package/worker/fuzzer/include/RTC/FuzzerDtlsTransport.hpp +4 -1
  54. package/worker/fuzzer/src/FuzzerUtils.cpp +5 -3
  55. package/worker/fuzzer/src/RTC/FuzzerDtlsTransport.cpp +8 -5
  56. package/worker/fuzzer/src/RTC/FuzzerRateCalculator.cpp +3 -3
  57. package/worker/fuzzer/src/RTC/FuzzerTrendCalculator.cpp +6 -6
  58. package/worker/fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTransport.cpp +3 -3
  59. package/worker/fuzzer/src/RTC/RTP/FuzzerPacket.cpp +2 -2
  60. package/worker/fuzzer/src/RTC/RTP/FuzzerRetransmissionBuffer.cpp +5 -5
  61. package/worker/fuzzer/src/RTC/RTP/FuzzerRtpStreamSend.cpp +3 -3
  62. package/worker/fuzzer/src/fuzzer.cpp +4 -0
  63. package/worker/include/Channel/ChannelNotification.hpp +3 -3
  64. package/worker/include/Channel/ChannelRequest.hpp +1 -1
  65. package/worker/include/Channel/ChannelSocket.hpp +11 -0
  66. package/worker/include/DepLibUV.hpp +16 -33
  67. package/worker/include/RTC/ActiveSpeakerObserver.hpp +11 -11
  68. package/worker/include/RTC/AudioLevelObserver.hpp +4 -4
  69. package/worker/include/RTC/BWE/AcknowledgedBitrateEstimatorInterface.hpp +55 -0
  70. package/worker/include/RTC/BWE/AimdRateControl.hpp +190 -0
  71. package/worker/include/RTC/BWE/BweTypes.hpp +211 -0
  72. package/worker/include/RTC/BWE/DelayBasedBwe.hpp +173 -0
  73. package/worker/include/RTC/BWE/FeedbackAdapter.hpp +72 -0
  74. package/worker/include/RTC/BWE/InterArrivalDelta.hpp +106 -0
  75. package/worker/include/RTC/BWE/LinkCapacityEstimator.hpp +84 -0
  76. package/worker/include/RTC/BWE/LossBasedController.hpp +520 -0
  77. package/worker/include/RTC/BWE/RobustThroughputEstimator.hpp +94 -0
  78. package/worker/include/RTC/BWE/SendPacketHistory.hpp +137 -0
  79. package/worker/include/RTC/BWE/TargetRateController.hpp +306 -0
  80. package/worker/include/RTC/BWE/TrendlineEstimator.hpp +143 -0
  81. package/worker/include/RTC/BWE/Utils.hpp +39 -0
  82. package/worker/include/RTC/Consts.hpp +6 -6
  83. package/worker/include/RTC/Consumer.hpp +14 -12
  84. package/worker/include/RTC/DataConsumer.hpp +3 -3
  85. package/worker/include/RTC/DataProducer.hpp +3 -3
  86. package/worker/include/RTC/DtlsTransport.hpp +5 -2
  87. package/worker/include/RTC/ICE/IceCandidate.hpp +2 -2
  88. package/worker/include/RTC/ICE/IceServer.hpp +3 -3
  89. package/worker/include/RTC/KeyFrameRequestManager.hpp +3 -3
  90. package/worker/include/RTC/NEW_RTCP/packet/Packet.hpp +1 -1
  91. package/worker/include/RTC/NackGenerator.hpp +12 -12
  92. package/worker/include/RTC/PipeProducerStreamManager.hpp +3 -4
  93. package/worker/include/RTC/PipeTransport.hpp +18 -5
  94. package/worker/include/RTC/PlainTransport.hpp +18 -5
  95. package/worker/include/RTC/PortManager.hpp +4 -4
  96. package/worker/include/RTC/Producer.hpp +21 -12
  97. package/worker/include/RTC/ProducerStreamManager.hpp +12 -6
  98. package/worker/include/RTC/RTCP/Bye.hpp +2 -2
  99. package/worker/include/RTC/RTCP/FeedbackPsRemb.hpp +4 -4
  100. package/worker/include/RTC/RTCP/FeedbackRtpTmmb.hpp +3 -3
  101. package/worker/include/RTC/RTCP/FeedbackRtpTransport.hpp +54 -39
  102. package/worker/include/RTC/RTCP/Packet.hpp +3 -3
  103. package/worker/include/RTC/RTCP/ReceiverReport.hpp +3 -3
  104. package/worker/include/RTC/RTCP/Sdes.hpp +2 -2
  105. package/worker/include/RTC/RTCP/XR.hpp +2 -2
  106. package/worker/include/RTC/RTCP/XrDelaySinceLastRr.hpp +1 -1
  107. package/worker/include/RTC/RTP/Codecs/H264.hpp +1 -1
  108. package/worker/include/RTC/RTP/Codecs/Opus.hpp +2 -2
  109. package/worker/include/RTC/RTP/Codecs/PayloadDescriptorHandler.hpp +3 -3
  110. package/worker/include/RTC/RTP/Codecs/VP8.hpp +2 -2
  111. package/worker/include/RTC/RTP/Codecs/VP9.hpp +2 -2
  112. package/worker/include/RTC/RTP/HeaderExtensionIds.hpp +12 -12
  113. package/worker/include/RTC/RTP/Packet.hpp +13 -13
  114. package/worker/include/RTC/RTP/ProbationGenerator.hpp +1 -1
  115. package/worker/include/RTC/RTP/RetransmissionBuffer.hpp +7 -7
  116. package/worker/include/RTC/RTP/RtpStream.hpp +37 -51
  117. package/worker/include/RTC/RTP/RtpStreamRecv.hpp +59 -41
  118. package/worker/include/RTC/RTP/RtpStreamSend.hpp +20 -14
  119. package/worker/include/RTC/RTP/RtxStream.hpp +12 -13
  120. package/worker/include/RTC/RateCalculator.hpp +50 -44
  121. package/worker/include/RTC/RemoteCaptureTimeEstimator.hpp +5 -4
  122. package/worker/include/RTC/RemoteClockOffsetEstimator.hpp +11 -11
  123. package/worker/include/RTC/Router.hpp +6 -0
  124. package/worker/include/RTC/RtcLogger.hpp +1 -1
  125. package/worker/include/RTC/RtpDictionaries.hpp +10 -10
  126. package/worker/include/RTC/SCTP/association/Association.hpp +56 -28
  127. package/worker/include/RTC/SCTP/association/HeartbeatHandler.hpp +4 -4
  128. package/worker/include/RTC/SCTP/association/StateCookie.hpp +14 -14
  129. package/worker/include/RTC/SCTP/association/StreamResetHandler.hpp +38 -2
  130. package/worker/include/RTC/SCTP/association/TransmissionControlBlock.hpp +12 -12
  131. package/worker/include/RTC/SCTP/association/TransmissionControlBlockContextInterface.hpp +4 -4
  132. package/worker/include/RTC/SCTP/packet/TLV.hpp +1 -1
  133. package/worker/include/RTC/SCTP/packet/parameters/StateCookieParameter.hpp +3 -3
  134. package/worker/include/RTC/SCTP/public/AssociationInterface.hpp +4 -1
  135. package/worker/include/RTC/SCTP/public/AssociationMetrics.hpp +1 -1
  136. package/worker/include/RTC/SCTP/public/SctpOptions.hpp +12 -12
  137. package/worker/include/RTC/SCTP/public/SctpTypes.hpp +6 -6
  138. package/worker/include/RTC/SCTP/rx/ReassemblyQueue.hpp +10 -0
  139. package/worker/include/RTC/SCTP/tx/OutstandingData.hpp +15 -16
  140. package/worker/include/RTC/SCTP/tx/RetransmissionQueue.hpp +7 -8
  141. package/worker/include/RTC/SCTP/tx/RetransmissionTimeout.hpp +20 -16
  142. package/worker/include/RTC/SCTP/tx/RoundRobinSendQueue.hpp +5 -6
  143. package/worker/include/RTC/SCTP/tx/SendQueueInterface.hpp +2 -2
  144. package/worker/include/RTC/SCTP/tx/StreamScheduler.hpp +5 -5
  145. package/worker/include/RTC/SctpDictionaries.hpp +3 -3
  146. package/worker/include/RTC/Serializable.hpp +1 -1
  147. package/worker/include/RTC/SimpleProducerStreamManager.hpp +3 -4
  148. package/worker/include/RTC/SimulcastProducerStreamManager.hpp +6 -7
  149. package/worker/include/RTC/SvcProducerStreamManager.hpp +6 -5
  150. package/worker/include/RTC/TcpConnection.hpp +9 -3
  151. package/worker/include/RTC/TcpServer.hpp +3 -0
  152. package/worker/include/RTC/Transport.hpp +52 -45
  153. package/worker/include/RTC/TransportCongestionControlClient.hpp +30 -25
  154. package/worker/include/RTC/TransportCongestionControlServer.hpp +17 -17
  155. package/worker/include/RTC/TrendCalculator.hpp +5 -5
  156. package/worker/include/RTC/UdpSocket.hpp +11 -2
  157. package/worker/include/RTC/WebRtcServer.hpp +20 -5
  158. package/worker/include/RTC/WebRtcTransport.hpp +35 -10
  159. package/worker/include/Settings.hpp +4 -2
  160. package/worker/include/Shared.hpp +5 -20
  161. package/worker/include/SharedInterface.hpp +6 -28
  162. package/worker/include/Utils.hpp +40 -21
  163. package/worker/include/common.hpp +4 -0
  164. package/worker/include/handles/BackoffTimerHandle.hpp +4 -4
  165. package/worker/include/handles/BackoffTimerHandleInterface.hpp +5 -5
  166. package/worker/include/handles/TcpConnectionHandle.hpp +6 -6
  167. package/worker/include/handles/TcpServerHandle.hpp +1 -1
  168. package/worker/include/handles/TimerHandle.hpp +15 -9
  169. package/worker/include/handles/TimerHandleInterface.hpp +10 -4
  170. package/worker/include/handles/UdpSocketHandle.hpp +3 -3
  171. package/worker/include/handles/UnixStreamSocketHandle.hpp +2 -2
  172. package/worker/meson.build +87 -36
  173. package/worker/meson_options.txt +1 -0
  174. package/worker/mocks/include/MockShared.hpp +24 -23
  175. package/worker/mocks/include/RTC/SCTP/association/MockTransmissionControlBlockContext.hpp +51 -27
  176. package/worker/mocks/include/RTC/SCTP/tx/MockSendQueue.hpp +11 -11
  177. package/worker/mocks/include/handles/MockBackoffTimerHandle.hpp +10 -10
  178. package/worker/mocks/include/handles/MockTimerHandle.hpp +60 -22
  179. package/worker/mocks/src/MockShared.cpp +51 -5
  180. package/worker/mocks/src/handles/MockBackoffTimerHandle.cpp +29 -15
  181. package/worker/mocks/src/handles/MockTimerHandle.cpp +117 -0
  182. package/worker/scripts/clang-scripts.mjs +2 -2
  183. package/worker/src/Channel/ChannelNotification.cpp +5 -6
  184. package/worker/src/Channel/ChannelSocket.cpp +20 -2
  185. package/worker/src/DepLibUV.cpp +4 -5
  186. package/worker/src/RTC/ActiveSpeakerObserver.cpp +59 -47
  187. package/worker/src/RTC/AudioLevelObserver.cpp +7 -7
  188. package/worker/src/RTC/BWE/AimdRateControl.cpp +468 -0
  189. package/worker/src/RTC/BWE/BweTypes.cpp +61 -0
  190. package/worker/src/RTC/BWE/DelayBasedBwe.cpp +275 -0
  191. package/worker/src/RTC/BWE/FeedbackAdapter.cpp +148 -0
  192. package/worker/src/RTC/BWE/InterArrivalDelta.cpp +181 -0
  193. package/worker/src/RTC/BWE/LinkCapacityEstimator.cpp +133 -0
  194. package/worker/src/RTC/BWE/LossBasedController.cpp +1046 -0
  195. package/worker/src/RTC/BWE/RobustThroughputEstimator.cpp +245 -0
  196. package/worker/src/RTC/BWE/SendPacketHistory.cpp +184 -0
  197. package/worker/src/RTC/BWE/TargetRateController.cpp +435 -0
  198. package/worker/src/RTC/BWE/TrendlineEstimator.cpp +311 -0
  199. package/worker/src/RTC/BWE/Utils.cpp +54 -0
  200. package/worker/src/RTC/Consumer.cpp +48 -35
  201. package/worker/src/RTC/DataConsumer.cpp +4 -4
  202. package/worker/src/RTC/DataProducer.cpp +3 -3
  203. package/worker/src/RTC/DirectTransport.cpp +2 -2
  204. package/worker/src/RTC/DtlsTransport.cpp +14 -11
  205. package/worker/src/RTC/ICE/IceServer.cpp +2 -2
  206. package/worker/src/RTC/KeyFrameRequestManager.cpp +16 -12
  207. package/worker/src/RTC/NackGenerator.cpp +12 -12
  208. package/worker/src/RTC/PipeProducerStreamManager.cpp +6 -6
  209. package/worker/src/RTC/PipeTransport.cpp +16 -13
  210. package/worker/src/RTC/PlainTransport.cpp +25 -16
  211. package/worker/src/RTC/Producer.cpp +50 -36
  212. package/worker/src/RTC/RTCP/FeedbackPsRemb.cpp +13 -6
  213. package/worker/src/RTC/RTCP/FeedbackRtpTmmb.cpp +14 -5
  214. package/worker/src/RTC/RTCP/FeedbackRtpTransport.cpp +76 -50
  215. package/worker/src/RTC/RTP/Codecs/VP8.cpp +1 -1
  216. package/worker/src/RTC/RTP/Codecs/VP9.cpp +4 -4
  217. package/worker/src/RTC/RTP/Packet.cpp +9 -10
  218. package/worker/src/RTC/RTP/RetransmissionBuffer.cpp +6 -6
  219. package/worker/src/RTC/RTP/RtpStream.cpp +19 -19
  220. package/worker/src/RTC/RTP/RtpStreamRecv.cpp +146 -81
  221. package/worker/src/RTC/RTP/RtpStreamSend.cpp +49 -44
  222. package/worker/src/RTC/RTP/RtxStream.cpp +7 -10
  223. package/worker/src/RTC/RateCalculator.cpp +99 -136
  224. package/worker/src/RTC/RemoteCaptureTimeEstimator.cpp +13 -13
  225. package/worker/src/RTC/RemoteClockOffsetEstimator.cpp +18 -17
  226. package/worker/src/RTC/Router.cpp +18 -1
  227. package/worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp +5 -2
  228. package/worker/src/RTC/SCTP/association/Association.cpp +146 -103
  229. package/worker/src/RTC/SCTP/association/AssociationListenerDeferrer.cpp +4 -4
  230. package/worker/src/RTC/SCTP/association/Capabilities.cpp +1 -1
  231. package/worker/src/RTC/SCTP/association/HeartbeatHandler.cpp +25 -18
  232. package/worker/src/RTC/SCTP/association/StateCookie.cpp +7 -6
  233. package/worker/src/RTC/SCTP/association/StreamResetHandler.cpp +122 -14
  234. package/worker/src/RTC/SCTP/association/TransmissionControlBlock.cpp +28 -26
  235. package/worker/src/RTC/SCTP/packet/chunks/SackChunk.cpp +0 -1
  236. package/worker/src/RTC/SCTP/packet/parameters/StateCookieParameter.cpp +2 -2
  237. package/worker/src/RTC/SCTP/public/AssociationMetrics.cpp +2 -2
  238. package/worker/src/RTC/SCTP/public/SctpOptions.cpp +13 -13
  239. package/worker/src/RTC/SCTP/rx/DataTracker.cpp +1 -1
  240. package/worker/src/RTC/SCTP/rx/ReassemblyQueue.cpp +5 -5
  241. package/worker/src/RTC/SCTP/tx/OutstandingData.cpp +15 -15
  242. package/worker/src/RTC/SCTP/tx/RetransmissionQueue.cpp +15 -15
  243. package/worker/src/RTC/SCTP/tx/RetransmissionTimeout.cpp +29 -26
  244. package/worker/src/RTC/SCTP/tx/RoundRobinSendQueue.cpp +12 -11
  245. package/worker/src/RTC/SCTP/tx/StreamScheduler.cpp +4 -4
  246. package/worker/src/RTC/SctpDictionaries/SctpStreamParameters.cpp +2 -2
  247. package/worker/src/RTC/SimpleProducerStreamManager.cpp +10 -10
  248. package/worker/src/RTC/SimulcastProducerStreamManager.cpp +39 -37
  249. package/worker/src/RTC/SvcProducerStreamManager.cpp +39 -25
  250. package/worker/src/RTC/TcpConnection.cpp +9 -3
  251. package/worker/src/RTC/TcpServer.cpp +7 -2
  252. package/worker/src/RTC/Transport.cpp +266 -307
  253. package/worker/src/RTC/TransportCongestionControlClient.cpp +78 -71
  254. package/worker/src/RTC/TransportCongestionControlServer.cpp +38 -40
  255. package/worker/src/RTC/TrendCalculator.cpp +3 -3
  256. package/worker/src/RTC/UdpSocket.cpp +14 -3
  257. package/worker/src/RTC/WebRtcServer.cpp +20 -14
  258. package/worker/src/RTC/WebRtcTransport.cpp +35 -30
  259. package/worker/src/Settings.cpp +10 -0
  260. package/worker/src/Shared.cpp +2 -2
  261. package/worker/src/Utils/Crypto.cpp +2 -2
  262. package/worker/src/Worker.cpp +5 -1
  263. package/worker/src/handles/BackoffTimerHandle.cpp +24 -11
  264. package/worker/src/handles/TimerHandle.cpp +74 -25
  265. package/worker/src/lib.cpp +6 -0
  266. package/worker/tasks.py +197 -45
  267. package/worker/test/include/RTC/BWE/helpers/LinkSimulator.hpp +117 -0
  268. package/worker/test/src/RTC/BWE/TestAimdRateControl.cpp +400 -0
  269. package/worker/test/src/RTC/BWE/TestDelayBasedBwe.cpp +568 -0
  270. package/worker/test/src/RTC/BWE/TestFeedbackAdapter.cpp +546 -0
  271. package/worker/test/src/RTC/BWE/TestInterArrivalDelta.cpp +301 -0
  272. package/worker/test/src/RTC/BWE/TestLinkCapacityEstimator.cpp +115 -0
  273. package/worker/test/src/RTC/BWE/TestLossBasedController.cpp +1199 -0
  274. package/worker/test/src/RTC/BWE/TestRobustThroughputEstimator.cpp +433 -0
  275. package/worker/test/src/RTC/BWE/TestSendPacketHistory.cpp +259 -0
  276. package/worker/test/src/RTC/BWE/TestTargetRateController.cpp +337 -0
  277. package/worker/test/src/RTC/BWE/TestTrendlineEstimator.cpp +182 -0
  278. package/worker/test/src/RTC/BWE/TestUtils.cpp +61 -0
  279. package/worker/test/src/RTC/BWE/helpers/LinkSimulator.cpp +171 -0
  280. package/worker/test/src/RTC/RTCP/TestFeedbackPsRemb.cpp +1 -1
  281. package/worker/test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp +1 -1
  282. package/worker/test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp +246 -208
  283. package/worker/test/src/RTC/RTP/TestPacket.cpp +11 -11
  284. package/worker/test/src/RTC/RTP/TestRetransmissionBuffer.cpp +12 -12
  285. package/worker/test/src/RTC/RTP/TestRtpStreamRecv.cpp +23 -16
  286. package/worker/test/src/RTC/RTP/TestRtpStreamSend.cpp +13 -13
  287. package/worker/test/src/RTC/SCTP/association/TestAssociation.cpp +27 -22
  288. package/worker/test/src/RTC/SCTP/association/TestHeartbeatHandler.cpp +21 -15
  289. package/worker/test/src/RTC/SCTP/association/TestStateCookie.cpp +6 -6
  290. package/worker/test/src/RTC/SCTP/association/TestStreamResetHandler.cpp +128 -13
  291. package/worker/test/src/RTC/SCTP/association/TestTransmissionControlBlock.cpp +3 -3
  292. package/worker/test/src/RTC/SCTP/packet/chunks/TestForwardTsnChunk.cpp +2 -2
  293. package/worker/test/src/RTC/SCTP/packet/chunks/TestIForwardTsnChunk.cpp +23 -23
  294. package/worker/test/src/RTC/SCTP/packet/chunks/TestInitChunk.cpp +1 -1
  295. package/worker/test/src/RTC/SCTP/packet/chunks/TestSackChunk.cpp +1 -1
  296. package/worker/test/src/RTC/SCTP/packet/parameters/TestIPv6AddressParameter.cpp +1 -1
  297. package/worker/test/src/RTC/SCTP/rx/TestDataTracker.cpp +37 -37
  298. package/worker/test/src/RTC/SCTP/rx/TestInterleavedReassemblyStreams.cpp +10 -10
  299. package/worker/test/src/RTC/SCTP/rx/TestReassemblyQueue.cpp +1 -1
  300. package/worker/test/src/RTC/SCTP/tx/TestOutstandingData.cpp +93 -93
  301. package/worker/test/src/RTC/SCTP/tx/TestRetransmissionQueue.cpp +247 -247
  302. package/worker/test/src/RTC/SCTP/tx/TestRetransmissionTimeout.cpp +100 -80
  303. package/worker/test/src/RTC/SCTP/tx/TestRoundRobinSendQueue.cpp +163 -163
  304. package/worker/test/src/RTC/SCTP/tx/TestStreamScheduler.cpp +76 -77
  305. package/worker/test/src/RTC/TestConsumer.cpp +8 -3
  306. package/worker/test/src/RTC/TestKeyFrameRequestManager.cpp +3 -3
  307. package/worker/test/src/RTC/TestNackGenerator.cpp +3 -3
  308. package/worker/test/src/RTC/TestPipeProducerStreamManager.cpp +5 -5
  309. package/worker/test/src/RTC/TestRateCalculator.cpp +110 -14
  310. package/worker/test/src/RTC/TestRemoteCaptureTimeEstimator.cpp +22 -17
  311. package/worker/test/src/RTC/TestRemoteClockOffsetEstimator.cpp +87 -85
  312. package/worker/test/src/RTC/TestSimpleProducerStreamManager.cpp +54 -47
  313. package/worker/test/src/RTC/TestSimulcastProducerStreamManager.cpp +83 -69
  314. package/worker/test/src/RTC/TestSvcProducerStreamManager.cpp +76 -65
  315. package/worker/test/src/RTC/TestTransportCongestionControlServer.cpp +72 -66
  316. package/worker/test/src/RTC/TestTransportTuple.cpp +19 -4
  317. package/worker/test/src/TestDepLibUV.cpp +19 -0
  318. package/worker/test/src/Utils/TestTime.cpp +57 -26
  319. package/worker/test/src/testHelpers.cpp +1 -1
  320. package/worker/test/src/tests.cpp +6 -0
  321. package/worker/include/RTC/SenderBandwidthEstimator.hpp +0 -118
  322. package/worker/src/RTC/SenderBandwidthEstimator.cpp +0 -269
@@ -123,7 +123,7 @@ table RecvRtpHeaderExtensions {
123
123
 
124
124
  table Options {
125
125
  direct: bool = false;
126
- initial_available_outgoing_bitrate: uint32 = null;
126
+ initial_available_outgoing_bitrate: uint64 = null;
127
127
  enable_sctp: bool = false;
128
128
  max_send_message_size: uint32;
129
129
  max_receive_message_size: uint32;
@@ -164,38 +164,38 @@ table Stats {
164
164
  timestamp: uint64;
165
165
  sctp_state: FBS.SctpAssociation.SctpState = null;
166
166
  bytes_received: uint64;
167
- recv_bitrate: uint32;
167
+ recv_bitrate: uint64;
168
168
  bytes_sent: uint64;
169
- send_bitrate: uint32;
169
+ send_bitrate: uint64;
170
170
  rtp_bytes_received: uint64;
171
- rtp_recv_bitrate: uint32;
171
+ rtp_recv_bitrate: uint64;
172
172
  rtp_bytes_sent: uint64;
173
- rtp_send_bitrate: uint32;
173
+ rtp_send_bitrate: uint64;
174
174
  rtx_bytes_received: uint64;
175
- rtx_recv_bitrate: uint32;
175
+ rtx_recv_bitrate: uint64;
176
176
  rtx_bytes_sent: uint64;
177
- rtx_send_bitrate: uint32;
177
+ rtx_send_bitrate: uint64;
178
178
  probation_bytes_sent: uint64;
179
- probation_send_bitrate: uint32;
180
- available_outgoing_bitrate: uint32 = null;
181
- available_incoming_bitrate: uint32 = null;
182
- max_incoming_bitrate: uint32 = null;
183
- max_outgoing_bitrate: uint32 = null;
184
- min_outgoing_bitrate: uint32 = null;
179
+ probation_send_bitrate: uint64;
180
+ available_outgoing_bitrate: uint64 = null;
181
+ available_incoming_bitrate: uint64 = null;
182
+ max_incoming_bitrate: uint64 = null;
183
+ max_outgoing_bitrate: uint64 = null;
184
+ min_outgoing_bitrate: uint64 = null;
185
185
  rtp_packet_loss_received: float64 = null;
186
186
  rtp_packet_loss_sent: float64 = null;
187
187
  }
188
188
 
189
189
  table SetMaxIncomingBitrateRequest {
190
- max_incoming_bitrate: uint32;
190
+ max_incoming_bitrate: uint64;
191
191
  }
192
192
 
193
193
  table SetMaxOutgoingBitrateRequest {
194
- max_outgoing_bitrate: uint32;
194
+ max_outgoing_bitrate: uint64;
195
195
  }
196
196
 
197
197
  table SetMinOutgoingBitrateRequest {
198
- min_outgoing_bitrate: uint32;
198
+ min_outgoing_bitrate: uint64;
199
199
  }
200
200
 
201
201
  table EnableTraceEventRequest {
@@ -245,13 +245,13 @@ enum BweType: uint8 {
245
245
 
246
246
  table BweTraceInfo {
247
247
  bwe_type: BweType;
248
- desired_bitrate: uint32;
249
- effective_desired_bitrate: uint32;
250
- min_bitrate: uint32;
251
- max_bitrate: uint32;
252
- start_bitrate: uint32;
253
- max_padding_bitrate: uint32;
254
- available_bitrate: uint32;
248
+ desired_bitrate: uint64;
249
+ effective_desired_bitrate: uint64;
250
+ min_bitrate: uint64;
251
+ max_bitrate: uint64;
252
+ start_bitrate: uint64;
253
+ max_padding_bitrate: uint64;
254
+ available_bitrate: uint64;
255
255
  }
256
256
 
257
257
  table TraceNotification {
@@ -24,7 +24,10 @@ namespace FuzzerRtcDtlsTransport
24
24
  void OnDtlsTransportSendData(
25
25
  const RTC::DtlsTransport* dtlsTransport, const uint8_t* data, size_t len) override;
26
26
  void OnDtlsTransportApplicationDataReceived(
27
- const RTC::DtlsTransport* dtlsTransport, const uint8_t* data, size_t len) override;
27
+ const RTC::DtlsTransport* dtlsTransport,
28
+ const uint8_t* data,
29
+ size_t len,
30
+ int64_t receivedAtUs) override;
28
31
  };
29
32
 
30
33
  void Fuzz(const uint8_t* data, size_t len);
@@ -92,8 +92,10 @@ void FuzzerUtils::Fuzz(const uint8_t* data, size_t len)
92
92
 
93
93
  /* Time class. */
94
94
 
95
- auto ntp = Utils::Time::TimeMs2Ntp(static_cast<uint64_t>(len));
95
+ auto ntp = Utils::Time::TimeUs2Ntp(static_cast<int64_t>(len));
96
96
 
97
- Utils::Time::Ntp2TimeMs(ntp);
98
- Utils::Time::TimeMsToAbsSendTime(static_cast<uint64_t>(len));
97
+ Utils::Time::Ntp2TimeUs(ntp);
98
+ Utils::Time::TimeUsToAbsSendTime(static_cast<int64_t>(len));
99
+ Utils::Time::Q32x32ToTimeUs(static_cast<int64_t>(len));
100
+ Utils::Time::TimeUs2Q32x32(static_cast<int64_t>(len));
99
101
  }
@@ -9,10 +9,10 @@
9
9
  namespace
10
10
  {
11
11
  // NOLINTNEXTLINE(readability-identifier-naming)
12
- thread_local mocks::MockShared shared(/*getTimeMs*/
13
- []()
12
+ thread_local mocks::MockShared shared(/*getTimeUs*/
13
+ []() -> int64_t
14
14
  {
15
- return 1000;
15
+ return 1000 * 1000;
16
16
  });
17
17
 
18
18
  // DtlsTransport instance. It's reset every time DTLS handshake fails or DTLS
@@ -70,7 +70,7 @@ void FuzzerRtcDtlsTransport::Fuzz(const uint8_t* data, size_t len)
70
70
  dtlsTransportSingleton->SetRemoteFingerprint(dtlsRemoteFingerprint);
71
71
  }
72
72
 
73
- dtlsTransportSingleton->ProcessDtlsData(data, len);
73
+ dtlsTransportSingleton->ProcessDtlsData(data, len, shared.GetTimeUs());
74
74
 
75
75
  // DTLS may have failed or closed after ProcessDtlsData(). If so, unset it.
76
76
  if (
@@ -125,7 +125,10 @@ void FuzzerRtcDtlsTransport::DtlsTransportListener::OnDtlsTransportSendData(
125
125
  }
126
126
 
127
127
  void FuzzerRtcDtlsTransport::DtlsTransportListener::OnDtlsTransportApplicationDataReceived(
128
- const RTC::DtlsTransport* /*dtlsTransport*/, const uint8_t* /*data*/, size_t /*len*/)
128
+ const RTC::DtlsTransport* /*dtlsTransport*/,
129
+ const uint8_t* /*data*/,
130
+ size_t /*len*/,
131
+ int64_t /*receivedAtUs*/)
129
132
  {
130
133
  MS_DEBUG_DEV("DtlsTransport singleton received application data");
131
134
  }
@@ -8,7 +8,7 @@ namespace
8
8
  {
9
9
  // NOLINTBEGIN(readability-identifier-naming)
10
10
  RTC::RateCalculator rateCalculator;
11
- uint64_t nowMs;
11
+ int64_t nowMs;
12
12
  // NOLINTEND(readability-identifier-naming)
13
13
 
14
14
  int init()
@@ -34,9 +34,9 @@ void FuzzerRtcRateCalculator::Fuzz(const uint8_t* data, size_t len)
34
34
  return;
35
35
  }
36
36
 
37
- auto size = Utils::Crypto::GetRandomUInt<size_t>(0u, static_cast<uint32_t>(RTC::Consts::MtuSize));
37
+ auto size = Utils::Crypto::GetRandomUInt<size_t>(0, static_cast<uint32_t>(RTC::Consts::MtuSize));
38
38
 
39
- nowMs += Utils::Crypto::GetRandomUInt<uint64_t>(0u, 1000u);
39
+ nowMs += static_cast<int64_t>(Utils::Crypto::GetRandomUInt<uint64_t>(0, 1000));
40
40
 
41
41
  rateCalculator.Update(size, nowMs);
42
42
 
@@ -6,20 +6,20 @@
6
6
  void FuzzerRtcTrendCalculator::Fuzz(const uint8_t* data, size_t len)
7
7
  {
8
8
  RTC::TrendCalculator trend;
9
- auto nowMs = DepLibUV::GetTimeMs();
10
- size_t offset{ 0u };
9
+ int64_t nowMs = DepLibUV::GetTimeMs();
10
+ size_t offset{ 0 };
11
11
 
12
- while (len >= 4u)
12
+ while (len >= 4)
13
13
  {
14
14
  const auto value = Utils::Byte::Get4Bytes(data, offset);
15
15
 
16
16
  trend.Update(value, nowMs);
17
17
  trend.GetValue();
18
- trend.Update(value, nowMs - 1000u);
18
+ trend.Update(value, nowMs - 1000);
19
19
  trend.GetValue();
20
20
 
21
- len -= 4u;
21
+ len -= 4;
22
22
  offset += 4;
23
- nowMs += 500u;
23
+ nowMs += 500;
24
24
  }
25
25
  }
@@ -10,11 +10,11 @@ void FuzzerRtcRtcpFeedbackRtpTransport::Fuzz(RTC::RTCP::FeedbackRtpTransportPack
10
10
  packet->GetBaseSequenceNumber();
11
11
  packet->GetPacketStatusCount();
12
12
  packet->GetReferenceTime();
13
- packet->GetReferenceTimestamp();
13
+ packet->GetReferenceTimestampUs();
14
14
  packet->GetFeedbackPacketCount();
15
15
  packet->GetLatestSequenceNumber();
16
- packet->GetLatestTimestamp();
17
- packet->GetPacketResults();
16
+ packet->GetLatestTimestampUs();
17
+ packet->GetPacketStatuses();
18
18
  packet->GetPacketFractionLost();
19
19
  packet->Serialize(RTC::RTCP::SerializationBuffer);
20
20
  }
@@ -91,7 +91,7 @@ void FuzzerRtcRtcPacket::Fuzz(const uint8_t* data, size_t len)
91
91
  packet->HasExtension(3);
92
92
  packet->GetExtensionValue(3, extenLen);
93
93
  packet->ReadAbsSendTime(absSendTime);
94
- packet->UpdateAbsSendTime(12345678u);
94
+ packet->UpdateAbsSendTime(12345678);
95
95
 
96
96
  packet->HasExtension(4);
97
97
  packet->GetExtensionValue(4, extenLen);
@@ -150,7 +150,7 @@ void FuzzerRtcRtcPacket::Fuzz(const uint8_t* data, size_t len)
150
150
  packet->SetExtensions(RTC::RTP::Packet::ExtensionsType::Auto, extensions);
151
151
 
152
152
  uint8_t value3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
153
- 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 };
153
+ 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 };
154
154
 
155
155
  extensions.emplace_back(
156
156
  RTC::RtpHeaderExtensionUri::Type::MID, // type
@@ -6,8 +6,8 @@
6
6
 
7
7
  void FuzzerRtcRtpRetransmissionBuffer::Fuzz(const uint8_t* data, size_t len)
8
8
  {
9
- const uint16_t maxItems{ 2500u };
10
- const uint32_t maxRetransmissionDelayMs{ 2000u };
9
+ const uint16_t maxItems{ 2500 };
10
+ const int64_t maxRetransmissionDelayMs{ 2000 };
11
11
  const uint32_t clockRate{ 90000 };
12
12
 
13
13
  // Trick to initialize our stuff just once (use static).
@@ -25,9 +25,9 @@ void FuzzerRtcRtpRetransmissionBuffer::Fuzz(const uint8_t* data, size_t len)
25
25
 
26
26
  // Create base RtpPacket instance.
27
27
  auto* packet = RTC::RTP::Packet::Parse(buffer, 12);
28
- size_t offset{ 0u };
28
+ size_t offset{ 0 };
29
29
 
30
- while (len >= 4u)
30
+ while (len >= 4)
31
31
  {
32
32
  const RTC::RTP::SharedPacket sharedPacket;
33
33
 
@@ -37,7 +37,7 @@ void FuzzerRtcRtpRetransmissionBuffer::Fuzz(const uint8_t* data, size_t len)
37
37
 
38
38
  retransmissionBuffer.Insert(packet, sharedPacket);
39
39
 
40
- len -= 4u;
40
+ len -= 4;
41
41
  offset += 4;
42
42
  }
43
43
 
@@ -6,10 +6,10 @@
6
6
  namespace
7
7
  {
8
8
  // NOLINTNEXTLINE(readability-identifier-naming)
9
- thread_local mocks::MockShared shared(/*getTimeMs*/
10
- []()
9
+ thread_local mocks::MockShared shared(/*getTimeUs*/
10
+ []() -> int64_t
11
11
  {
12
- return 1000;
12
+ return 1000 * 1000;
13
13
  });
14
14
  } // namespace
15
15
 
@@ -3,7 +3,9 @@
3
3
  #include "common.hpp"
4
4
  #include "DepLibSRTP.hpp"
5
5
  #include "DepLibUV.hpp"
6
+ #ifndef MS_USE_BUILTIN_BWE
6
7
  #include "DepLibWebRTC.hpp"
8
+ #endif
7
9
  #include "DepOpenSSL.hpp"
8
10
  #include "FuzzerUtils.hpp"
9
11
  #include "RTC/DtlsTransport.hpp"
@@ -144,7 +146,9 @@ namespace
144
146
  DepLibUV::ClassInit();
145
147
  DepOpenSSL::ClassInit();
146
148
  DepLibSRTP::ClassInit();
149
+ #ifndef MS_USE_BUILTIN_BWE
147
150
  DepLibWebRTC::ClassInit();
151
+ #endif
148
152
  Utils::Crypto::ClassInit();
149
153
  RTC::DtlsTransport::ClassInit();
150
154
 
@@ -12,16 +12,16 @@ namespace Channel
12
12
  using Event = FBS::Notification::Event;
13
13
 
14
14
  public:
15
- explicit ChannelNotification(const FBS::Notification::Notification* notification);
15
+ ChannelNotification(const FBS::Notification::Notification* notification, int64_t receivedAtUs);
16
16
  ~ChannelNotification() = default;
17
17
 
18
18
  public:
19
19
  // Passed by argument.
20
- Event event;
20
+ const FBS::Notification::Notification* data{ nullptr };
21
+ int64_t receivedAtUs{ 0 };
21
22
  // Others.
22
23
  const char* eventCStr;
23
24
  std::string handlerId;
24
- const FBS::Notification::Notification* data{ nullptr };
25
25
  };
26
26
  } // namespace Channel
27
27
 
@@ -68,7 +68,7 @@ namespace Channel
68
68
  Channel::ChannelSocket* channel{ nullptr };
69
69
  const FBS::Request::Request* data{ nullptr };
70
70
  // Others.
71
- uint32_t id{ 0u };
71
+ uint32_t id{ 0 };
72
72
  Method method;
73
73
  const char* methodCStr;
74
74
  std::string handlerId;
@@ -6,6 +6,10 @@
6
6
  #include "Channel/ChannelRequest.hpp"
7
7
  #include "handles/UnixStreamSocketHandle.hpp"
8
8
 
9
+ // Avoid cyclic #include problem by declaring the class instead of including the
10
+ // corresponding header file.
11
+ class SharedInterface;
12
+
9
13
  namespace Channel
10
14
  {
11
15
  class ConsumerSocket : public UnixStreamSocketHandle
@@ -96,6 +100,12 @@ namespace Channel
96
100
  public:
97
101
  void Close();
98
102
  void SetListener(Listener* listener);
103
+ /**
104
+ * @remarks
105
+ * - Must be called before the libuv loop runs, since notifications take
106
+ * their arrival time from it.
107
+ */
108
+ void SetShared(SharedInterface* shared);
99
109
  void Send(const uint8_t* data, uint32_t dataLen);
100
110
  void SendLog(const char* data, uint32_t dataLen);
101
111
  bool CallbackRead();
@@ -111,6 +121,7 @@ namespace Channel
111
121
  private:
112
122
  // Passed by argument.
113
123
  Listener* listener{ nullptr };
124
+ SharedInterface* shared{ nullptr };
114
125
  // Others.
115
126
  bool closed{ false };
116
127
  ConsumerSocket* consumerSocket{ nullptr };
@@ -20,57 +20,40 @@ public:
20
20
  return DepLibUV::loop;
21
21
  }
22
22
 
23
- static uint64_t GetTimeMs()
24
- {
25
- return static_cast<uint64_t>(uv_hrtime() / 1000000u);
26
- }
27
-
28
23
  /**
29
- * Offset between our own monotonic clock and the NTP epoch (ms).
30
- *
31
- * @remarks
32
- * - It is taken just once, in ClassInit(), so that the NTP timestamps we generate
33
- * never step when the system clock is adjusted. They just drift away from the real
34
- * wall clock as much as our monotonic clock does.
24
+ * Current value of the monotonic clock (ms).
35
25
  */
36
- static uint64_t GetNtpOffsetMs()
26
+ static int64_t GetTimeMs()
37
27
  {
38
- return DepLibUV::ntpOffsetMs;
39
- }
40
-
41
- static uint64_t GetTimeUs()
42
- {
43
- return static_cast<uint64_t>(uv_hrtime() / 1000u);
44
- }
45
-
46
- static uint64_t GetTimeNs()
47
- {
48
- return uv_hrtime();
28
+ return static_cast<int64_t>(uv_hrtime() / 1000000);
49
29
  }
50
30
 
51
31
  /**
52
- * Used within libwebrtc dependency which uses int64_t values for time
53
- * representation.
32
+ * Current value of the monotonic clock (us).
54
33
  */
55
- static int64_t GetTimeMsInt64()
34
+ static int64_t GetTimeUs()
56
35
  {
57
- return static_cast<int64_t>(DepLibUV::GetTimeMs());
36
+ return static_cast<int64_t>(uv_hrtime() / 1000);
58
37
  }
59
38
 
60
39
  /**
61
- * Used within libwebrtc dependency which uses int64_t values for time
62
- * representation.
40
+ * Offset between our own monotonic clock and the NTP epoch (us).
41
+ *
42
+ * @remarks
43
+ * - It is taken just once, in ClassInit(), so that the NTP timestamps we generate
44
+ * never step when the system clock is adjusted. They just drift away from the real
45
+ * wall clock as much as our monotonic clock does.
63
46
  */
64
- static int64_t GetTimeUsInt64()
47
+ static int64_t GetNtpOffsetUs()
65
48
  {
66
- return static_cast<int64_t>(DepLibUV::GetTimeUs());
49
+ return DepLibUV::ntpOffsetUs;
67
50
  }
68
51
 
69
52
  private:
70
53
  static thread_local uv_loop_t* loop;
71
- // Distance from our own monotonic clock to the NTP epoch (ms), taken at
54
+ // Distance from our own monotonic clock to the NTP epoch (us), taken at
72
55
  // ClassInit().
73
- static thread_local uint64_t ntpOffsetMs;
56
+ static thread_local int64_t ntpOffsetUs;
74
57
  };
75
58
 
76
59
  #endif
@@ -25,8 +25,8 @@ namespace RTC
25
25
  public:
26
26
  void EvalActivityScores();
27
27
  double GetActivityScore(uint8_t interval) const;
28
- void LevelChanged(uint32_t level, uint64_t now);
29
- void LevelTimedOut(uint64_t now);
28
+ void LevelChanged(uint32_t level, int64_t nowMs);
29
+ void LevelTimedOut(int64_t nowMs);
30
30
 
31
31
  private:
32
32
  bool ComputeImmediates();
@@ -42,17 +42,17 @@ namespace RTC
42
42
  double immediateActivityScore{ 0 };
43
43
  double mediumActivityScore{ 0 };
44
44
  double longActivityScore{ 0 };
45
- uint64_t lastLevelChangeTime{ 0 };
45
+ int64_t lastLevelChangeAtMs{ 0 };
46
46
 
47
47
  private:
48
- uint8_t minLevel{ 0u };
49
- uint8_t nextMinLevel{ 0u };
50
- uint32_t nextMinLevelWindowLen{ 0u };
48
+ uint8_t minLevel{ 0 };
49
+ uint8_t nextMinLevel{ 0 };
50
+ uint32_t nextMinLevelWindowLen{ 0 };
51
51
  std::vector<uint8_t> immediates;
52
52
  std::vector<uint8_t> mediums;
53
53
  std::vector<uint8_t> longs;
54
54
  std::vector<uint8_t> levels;
55
- size_t nextLevelIndex{ 0u };
55
+ size_t nextLevelIndex{ 0 };
56
56
  };
57
57
 
58
58
  class ProducerSpeaker
@@ -67,7 +67,7 @@ namespace RTC
67
67
  };
68
68
 
69
69
  private:
70
- static const uint8_t RelativeSpeachActivitiesLen{ 3u };
70
+ static const uint8_t RelativeSpeachActivitiesLen{ 3 };
71
71
 
72
72
  public:
73
73
  ActiveSpeakerObserver(
@@ -89,7 +89,7 @@ namespace RTC
89
89
  void Resumed() override;
90
90
  void Update();
91
91
  bool CalculateActiveSpeaker();
92
- void TimeoutIdleLevels(uint64_t now);
92
+ void TimeoutIdleLevels(int64_t nowMs);
93
93
 
94
94
  /* Pure virtual methods inherited from TimerHandleInterface. */
95
95
  protected:
@@ -99,10 +99,10 @@ namespace RTC
99
99
  double relativeSpeachActivities[RelativeSpeachActivitiesLen]{};
100
100
  std::string dominantId;
101
101
  TimerHandleInterface* periodicTimer{ nullptr };
102
- uint16_t interval{ 300u };
102
+ int64_t intervalMs{ 300 };
103
103
  // Map of ProducerSpeakers indexed by Producer id.
104
104
  ankerl::unordered_dense::map<std::string, ProducerSpeaker*> mapProducerSpeakers;
105
- uint64_t lastLevelIdleTime{ 0u };
105
+ int64_t lastLevelIdleAtMs{ 0 };
106
106
  };
107
107
  } // namespace RTC
108
108
 
@@ -13,8 +13,8 @@ namespace RTC
13
13
  private:
14
14
  struct DBovs
15
15
  {
16
- uint16_t totalSum{ 0u }; // Sum of dBvos (positive integer).
17
- size_t count{ 0u }; // Number of dBvos entries in totalSum.
16
+ uint16_t totalSum{ 0 }; // Sum of dBvos (positive integer).
17
+ size_t count{ 0 }; // Number of dBvos entries in totalSum.
18
18
  };
19
19
 
20
20
  public:
@@ -44,9 +44,9 @@ namespace RTC
44
44
 
45
45
  private:
46
46
  // Passed by argument.
47
- uint16_t maxEntries{ 1u };
47
+ uint16_t maxEntries{ 1 };
48
48
  int8_t threshold{ -80 };
49
- uint16_t interval{ 1000u };
49
+ int64_t intervalMs{ 1000 };
50
50
  // Allocated by this.
51
51
  TimerHandleInterface* periodicTimer{ nullptr };
52
52
  // Others.
@@ -0,0 +1,55 @@
1
+ #ifndef MS_RTC_BWE_ACKNOWLEDGED_BITRATE_ESTIMATOR_INTERFACE_HPP
2
+ #define MS_RTC_BWE_ACKNOWLEDGED_BITRATE_ESTIMATOR_INTERFACE_HPP
3
+
4
+ #include "common.hpp"
5
+ #include "RTC/BWE/BweTypes.hpp"
6
+
7
+ namespace RTC
8
+ {
9
+ namespace BWE
10
+ {
11
+ /**
12
+ * Measures the bitrate the receiver is acknowledging, which is what the rate
13
+ * control compares its target against.
14
+ */
15
+ class AcknowledgedBitrateEstimatorInterface
16
+ {
17
+ public:
18
+ AcknowledgedBitrateEstimatorInterface() = default;
19
+
20
+ AcknowledgedBitrateEstimatorInterface& operator=(
21
+ const AcknowledgedBitrateEstimatorInterface&) = delete;
22
+
23
+ AcknowledgedBitrateEstimatorInterface(const AcknowledgedBitrateEstimatorInterface&) = delete;
24
+
25
+ virtual ~AcknowledgedBitrateEstimatorInterface() = default;
26
+
27
+ public:
28
+ /**
29
+ * Feed the packets a feedback reported as received.
30
+ *
31
+ * @param packetResults - The reported packets, ordered by arrival time.
32
+ */
33
+ virtual void IncomingPacketFeedbackVector(
34
+ const std::vector<Types::PacketResult>& packetResults) = 0;
35
+
36
+ /**
37
+ * Acknowledged bitrate (bps), or no value if it cannot be measured yet.
38
+ */
39
+ virtual std::optional<int64_t> GetBitrate() const = 0;
40
+
41
+ /**
42
+ * @param inAlr - Whether the sender is in an application limited region.
43
+ */
44
+ virtual void SetAlr(bool inAlr) = 0;
45
+
46
+ /**
47
+ * @param alrEndedTimeUs - Time at which the sender stopped being in an
48
+ * application limited region.
49
+ */
50
+ virtual void SetAlrEndedTimeUs(int64_t alrEndedTimeUs) = 0;
51
+ };
52
+ } // namespace BWE
53
+ } // namespace RTC
54
+
55
+ #endif