werift 0.25.2 → 0.27.0

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 (568) hide show
  1. package/README.md +63 -0
  2. package/THIRD_PARTY_LICENSES_LIBWEBRTC.txt +58 -0
  3. package/lib/common/src/asn1.d.ts +42 -0
  4. package/lib/common/src/asn1.js +163 -0
  5. package/lib/common/src/asn1.js.map +1 -0
  6. package/lib/common/src/binary.d.ts +1 -3
  7. package/lib/common/src/binary.js +8 -6
  8. package/lib/common/src/binary.js.map +1 -1
  9. package/lib/common/src/binaryData.js +2 -1
  10. package/lib/common/src/binaryData.js.map +1 -1
  11. package/lib/common/src/index.d.ts +6 -5
  12. package/lib/common/src/index.js +6 -5
  13. package/lib/common/src/index.js.map +1 -1
  14. package/lib/common/src/log.d.ts +12 -1
  15. package/lib/common/src/log.js +142 -12
  16. package/lib/common/src/log.js.map +1 -1
  17. package/lib/common/src/network.js.map +1 -1
  18. package/lib/common/src/queue.d.ts +41 -0
  19. package/lib/common/src/queue.js +146 -0
  20. package/lib/common/src/queue.js.map +1 -0
  21. package/lib/common/src/transport.d.ts +15 -2
  22. package/lib/common/src/transport.js +108 -19
  23. package/lib/common/src/transport.js.map +1 -1
  24. package/lib/dtls/src/cipher/create.js.map +1 -1
  25. package/lib/dtls/src/cipher/ec.js +8 -8
  26. package/lib/dtls/src/cipher/ec.js.map +1 -1
  27. package/lib/dtls/src/cipher/namedCurve.js +6 -7
  28. package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
  29. package/lib/dtls/src/cipher/prf.d.ts +2 -2
  30. package/lib/dtls/src/cipher/prf.js +29 -8
  31. package/lib/dtls/src/cipher/prf.js.map +1 -1
  32. package/lib/dtls/src/cipher/suites/aead.d.ts +1 -1
  33. package/lib/dtls/src/context/certificate.d.ts +32 -0
  34. package/lib/dtls/src/context/certificate.js +54 -0
  35. package/lib/dtls/src/context/certificate.js.map +1 -0
  36. package/lib/dtls/src/context/cipher.d.ts +13 -7
  37. package/lib/dtls/src/context/cipher.js +58 -106
  38. package/lib/dtls/src/context/cipher.js.map +1 -1
  39. package/lib/dtls/src/context/dtls.js +4 -2
  40. package/lib/dtls/src/context/dtls.js.map +1 -1
  41. package/lib/dtls/src/context/transport.d.ts +4 -0
  42. package/lib/dtls/src/context/transport.js +16 -1
  43. package/lib/dtls/src/context/transport.js.map +1 -1
  44. package/lib/dtls/src/flight/client/flight1.js +2 -1
  45. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  46. package/lib/dtls/src/flight/client/flight5.js +4 -2
  47. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  48. package/lib/dtls/src/flight/flight.d.ts +1 -1
  49. package/lib/dtls/src/flight/flight.js +16 -5
  50. package/lib/dtls/src/flight/flight.js.map +1 -1
  51. package/lib/dtls/src/flight/server/flight2.js.map +1 -1
  52. package/lib/dtls/src/flight/server/flight4.d.ts +2 -1
  53. package/lib/dtls/src/flight/server/flight4.js +12 -4
  54. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  55. package/lib/dtls/src/flight/server/flight6.js +2 -1
  56. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  57. package/lib/dtls/src/handshake/const.d.ts +17 -13
  58. package/lib/dtls/src/handshake/const.js +16 -14
  59. package/lib/dtls/src/handshake/const.js.map +1 -1
  60. package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -1
  61. package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
  62. package/lib/dtls/src/handshake/message/alert.js +5 -3
  63. package/lib/dtls/src/handshake/message/alert.js.map +1 -1
  64. package/lib/dtls/src/handshake/message/certificate.js +3 -2
  65. package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
  66. package/lib/dtls/src/handshake/message/changeCipherSpec.js +4 -4
  67. package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
  68. package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +1 -1
  69. package/lib/dtls/src/handshake/message/client/certificateVerify.js +5 -3
  70. package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
  71. package/lib/dtls/src/handshake/message/client/hello.js +15 -8
  72. package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
  73. package/lib/dtls/src/handshake/message/client/keyExchange.js +3 -2
  74. package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
  75. package/lib/dtls/src/handshake/message/finished.js +2 -1
  76. package/lib/dtls/src/handshake/message/finished.js.map +1 -1
  77. package/lib/dtls/src/handshake/message/server/certificateRequest.d.ts +1 -1
  78. package/lib/dtls/src/handshake/message/server/certificateRequest.js +7 -4
  79. package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
  80. package/lib/dtls/src/handshake/message/server/hello.d.ts +1 -1
  81. package/lib/dtls/src/handshake/message/server/hello.js +14 -8
  82. package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
  83. package/lib/dtls/src/handshake/message/server/helloDone.js +1 -1
  84. package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
  85. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +5 -3
  86. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
  87. package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +1 -1
  88. package/lib/dtls/src/handshake/message/server/keyExchange.js +17 -9
  89. package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
  90. package/lib/dtls/src/handshake/random.d.ts +1 -1
  91. package/lib/dtls/src/handshake/random.js +7 -4
  92. package/lib/dtls/src/handshake/random.js.map +1 -1
  93. package/lib/dtls/src/imports/common.d.ts +1 -0
  94. package/lib/dtls/src/imports/common.js +1 -0
  95. package/lib/dtls/src/imports/common.js.map +1 -1
  96. package/lib/dtls/src/index.d.ts +2 -2
  97. package/lib/dtls/src/index.js +2 -2
  98. package/lib/dtls/src/index.js.map +1 -1
  99. package/lib/dtls/src/record/const.d.ts +43 -33
  100. package/lib/dtls/src/record/const.js +43 -36
  101. package/lib/dtls/src/record/const.js.map +1 -1
  102. package/lib/dtls/src/record/message/fragment.d.ts +1 -1
  103. package/lib/dtls/src/record/message/fragment.js +15 -9
  104. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  105. package/lib/dtls/src/record/message/header.js +12 -7
  106. package/lib/dtls/src/record/message/header.js.map +1 -1
  107. package/lib/dtls/src/record/message/plaintext.js +4 -2
  108. package/lib/dtls/src/record/message/plaintext.js.map +1 -1
  109. package/lib/dtls/src/record/receive.js +2 -2
  110. package/lib/dtls/src/record/receive.js.map +1 -1
  111. package/lib/dtls/src/server.js +1 -1
  112. package/lib/dtls/src/server.js.map +1 -1
  113. package/lib/dtls/src/socket.d.ts +2 -2
  114. package/lib/dtls/src/socket.js +6 -4
  115. package/lib/dtls/src/socket.js.map +1 -1
  116. package/lib/ice/src/candidate.d.ts +1 -1
  117. package/lib/ice/src/candidate.js +24 -12
  118. package/lib/ice/src/candidate.js.map +1 -1
  119. package/lib/ice/src/dns/lookup.d.ts +10 -1
  120. package/lib/ice/src/dns/lookup.js +42 -7
  121. package/lib/ice/src/dns/lookup.js.map +1 -1
  122. package/lib/ice/src/exceptions.d.ts +46 -0
  123. package/lib/ice/src/exceptions.js +92 -5
  124. package/lib/ice/src/exceptions.js.map +1 -1
  125. package/lib/ice/src/helper.d.ts +1 -1
  126. package/lib/ice/src/ice.d.ts +191 -5
  127. package/lib/ice/src/ice.js +1048 -156
  128. package/lib/ice/src/ice.js.map +1 -1
  129. package/lib/ice/src/iceBase.d.ts +174 -10
  130. package/lib/ice/src/iceBase.js +165 -12
  131. package/lib/ice/src/iceBase.js.map +1 -1
  132. package/lib/ice/src/index.d.ts +5 -5
  133. package/lib/ice/src/index.js +5 -5
  134. package/lib/ice/src/index.js.map +1 -1
  135. package/lib/ice/src/internal/resolveHostAddresses.d.ts +26 -0
  136. package/lib/ice/src/internal/resolveHostAddresses.js +45 -0
  137. package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -0
  138. package/lib/ice/src/stun/protocol.d.ts +3 -1
  139. package/lib/ice/src/stun/protocol.js +16 -0
  140. package/lib/ice/src/stun/protocol.js.map +1 -1
  141. package/lib/ice/src/stun/tcpProtocol.d.ts +2 -0
  142. package/lib/ice/src/stun/tcpProtocol.js +16 -1
  143. package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
  144. package/lib/ice/src/stun/transaction.d.ts +35 -1
  145. package/lib/ice/src/stun/transaction.js +93 -18
  146. package/lib/ice/src/stun/transaction.js.map +1 -1
  147. package/lib/ice/src/turn/credential.d.ts +49 -0
  148. package/lib/ice/src/turn/credential.js +78 -0
  149. package/lib/ice/src/turn/credential.js.map +1 -0
  150. package/lib/ice/src/turn/protocol.d.ts +97 -7
  151. package/lib/ice/src/turn/protocol.js +357 -55
  152. package/lib/ice/src/turn/protocol.js.map +1 -1
  153. package/lib/ice/src/utils.js.map +1 -1
  154. package/lib/ice-server/src/stun/attributes.d.ts +2 -0
  155. package/lib/ice-server/src/stun/attributes.js +7 -1
  156. package/lib/ice-server/src/stun/attributes.js.map +1 -1
  157. package/lib/ice-server/src/stun/const.d.ts +24 -16
  158. package/lib/ice-server/src/stun/const.js +22 -18
  159. package/lib/ice-server/src/stun/const.js.map +1 -1
  160. package/lib/ice-server/src/stun/message.d.ts +3 -1
  161. package/lib/ice-server/src/stun/message.js +41 -6
  162. package/lib/ice-server/src/stun/message.js.map +1 -1
  163. package/lib/ice-server/src/turn/auth.d.ts +1 -1
  164. package/lib/index.mjs +25252 -12664
  165. package/lib/nonstandard/index.mjs +11015 -8906
  166. package/lib/polyfill/dom.mjs +30779 -18386
  167. package/lib/polyfill/index.mjs +30779 -18386
  168. package/lib/rtp/src/codec/assertPayload.d.ts +4 -0
  169. package/lib/rtp/src/codec/assertPayload.js +12 -0
  170. package/lib/rtp/src/codec/assertPayload.js.map +1 -0
  171. package/lib/rtp/src/codec/av1.js +2 -0
  172. package/lib/rtp/src/codec/av1.js.map +1 -1
  173. package/lib/rtp/src/codec/h264.d.ts +1 -1
  174. package/lib/rtp/src/codec/h264.js +35 -43
  175. package/lib/rtp/src/codec/h264.js.map +1 -1
  176. package/lib/rtp/src/codec/vp8.js +11 -5
  177. package/lib/rtp/src/codec/vp8.js.map +1 -1
  178. package/lib/rtp/src/codec/vp9.js +12 -0
  179. package/lib/rtp/src/codec/vp9.js.map +1 -1
  180. package/lib/rtp/src/extra/container/mp4/container.js +2 -1
  181. package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
  182. package/lib/rtp/src/extra/container/mp4/exp-golomb.js +2 -1
  183. package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
  184. package/lib/rtp/src/extra/container/mp4/h264.d.ts +21 -17
  185. package/lib/rtp/src/extra/container/mp4/h264.js +26 -24
  186. package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
  187. package/lib/rtp/src/extra/container/ogg/index.d.ts +1 -0
  188. package/lib/rtp/src/extra/container/ogg/index.js +1 -0
  189. package/lib/rtp/src/extra/container/ogg/index.js.map +1 -1
  190. package/lib/rtp/src/extra/container/ogg/writer.d.ts +90 -0
  191. package/lib/rtp/src/extra/container/ogg/writer.js +300 -0
  192. package/lib/rtp/src/extra/container/ogg/writer.js.map +1 -0
  193. package/lib/rtp/src/extra/container/webm/container.d.ts +1 -1
  194. package/lib/rtp/src/extra/container/webm/ebml/ebml.d.ts +6 -0
  195. package/lib/rtp/src/extra/container/webm/ebml/ebml.js +26 -4
  196. package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
  197. package/lib/rtp/src/extra/processor/depacketizer.d.ts +6 -1
  198. package/lib/rtp/src/extra/processor/depacketizer.js +29 -3
  199. package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
  200. package/lib/rtp/src/extra/processor/depacketizerCallback.d.ts +1 -11
  201. package/lib/rtp/src/extra/processor/depacketizerTransformer.d.ts +1 -1
  202. package/lib/rtp/src/extra/processor/dtx.js +4 -2
  203. package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
  204. package/lib/rtp/src/extra/processor/dtxCallback.d.ts +1 -11
  205. package/lib/rtp/src/extra/processor/index.d.ts +2 -0
  206. package/lib/rtp/src/extra/processor/index.js +2 -0
  207. package/lib/rtp/src/extra/processor/index.js.map +1 -1
  208. package/lib/rtp/src/extra/processor/interface.d.ts +16 -11
  209. package/lib/rtp/src/extra/processor/interface.js.map +1 -1
  210. package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +29 -6
  211. package/lib/rtp/src/extra/processor/jitterBuffer.js +101 -111
  212. package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
  213. package/lib/rtp/src/extra/processor/jitterBufferCallback.d.ts +1 -11
  214. package/lib/rtp/src/extra/processor/jitterBufferTransformer.d.ts +1 -1
  215. package/lib/rtp/src/extra/processor/jitterBufferTransformer.js +2 -1
  216. package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
  217. package/lib/rtp/src/extra/processor/lipsync.d.ts +63 -0
  218. package/lib/rtp/src/extra/processor/lipsync.js +202 -51
  219. package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
  220. package/lib/rtp/src/extra/processor/mp4.d.ts +0 -6
  221. package/lib/rtp/src/extra/processor/mp4.js +7 -4
  222. package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
  223. package/lib/rtp/src/extra/processor/mute.js +4 -2
  224. package/lib/rtp/src/extra/processor/mute.js.map +1 -1
  225. package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
  226. package/lib/rtp/src/extra/processor/nack.js +5 -3
  227. package/lib/rtp/src/extra/processor/nack.js.map +1 -1
  228. package/lib/rtp/src/extra/processor/nackHandlerCallback.d.ts +1 -11
  229. package/lib/rtp/src/extra/processor/ntpTime.js +4 -6
  230. package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
  231. package/lib/rtp/src/extra/processor/ntpTimeCallback.d.ts +1 -11
  232. package/lib/rtp/src/extra/processor/ogg.d.ts +72 -0
  233. package/lib/rtp/src/extra/processor/ogg.js +221 -0
  234. package/lib/rtp/src/extra/processor/ogg.js.map +1 -0
  235. package/lib/rtp/src/extra/processor/oggCallback.d.ts +21 -0
  236. package/lib/rtp/src/extra/processor/oggCallback.js +97 -0
  237. package/lib/rtp/src/extra/processor/oggCallback.js.map +1 -0
  238. package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +1 -1
  239. package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
  240. package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -1
  241. package/lib/rtp/src/extra/processor/rtpCallback.js +3 -2
  242. package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
  243. package/lib/rtp/src/extra/processor/rtpStream.d.ts +2 -2
  244. package/lib/rtp/src/extra/processor/rtpStream.js +2 -1
  245. package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
  246. package/lib/rtp/src/extra/processor/rtpTime.js +2 -1
  247. package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
  248. package/lib/rtp/src/extra/processor/rtpTimeCallback.d.ts +1 -11
  249. package/lib/rtp/src/extra/processor/webm.d.ts +27 -0
  250. package/lib/rtp/src/extra/processor/webm.js +57 -23
  251. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  252. package/lib/rtp/src/extra/processor/webmCallback.js +6 -1
  253. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  254. package/lib/rtp/src/extra/processor/webmStream.js.map +1 -1
  255. package/lib/rtp/src/helper.d.ts +2 -2
  256. package/lib/rtp/src/helper.js +2 -6
  257. package/lib/rtp/src/helper.js.map +1 -1
  258. package/lib/rtp/src/index.d.ts +10 -2
  259. package/lib/rtp/src/index.js +10 -2
  260. package/lib/rtp/src/index.js.map +1 -1
  261. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +4 -0
  262. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +6 -1
  263. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
  264. package/lib/rtp/src/rtcp/rtcp.js +9 -4
  265. package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
  266. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.d.ts +58 -0
  267. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js +143 -0
  268. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js.map +1 -0
  269. package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +35 -13
  270. package/lib/rtp/src/rtcp/rtpfb/twcc.js +132 -54
  271. package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
  272. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.d.ts +13 -0
  273. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js +29 -0
  274. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js.map +1 -0
  275. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.d.ts +41 -0
  276. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js +89 -0
  277. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js.map +1 -0
  278. package/lib/rtp/src/rtcp/sr.d.ts +4 -3
  279. package/lib/rtp/src/rtcp/sr.js +4 -2
  280. package/lib/rtp/src/rtcp/sr.js.map +1 -1
  281. package/lib/rtp/src/rtp/continuity.d.ts +36 -0
  282. package/lib/rtp/src/rtp/continuity.js +100 -0
  283. package/lib/rtp/src/rtp/continuity.js.map +1 -0
  284. package/lib/rtp/src/rtp/headerExtension.js +41 -21
  285. package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
  286. package/lib/rtp/src/rtp/padding.d.ts +17 -0
  287. package/lib/rtp/src/rtp/padding.js +37 -0
  288. package/lib/rtp/src/rtp/padding.js.map +1 -0
  289. package/lib/rtp/src/rtp/red/encoder.d.ts +10 -0
  290. package/lib/rtp/src/rtp/red/encoder.js +14 -1
  291. package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
  292. package/lib/rtp/src/rtp/red/packet.js +24 -8
  293. package/lib/rtp/src/rtp/red/packet.js.map +1 -1
  294. package/lib/rtp/src/rtp/rtp.d.ts +24 -1
  295. package/lib/rtp/src/rtp/rtp.js +70 -29
  296. package/lib/rtp/src/rtp/rtp.js.map +1 -1
  297. package/lib/rtp/src/rtp/rtx.js +3 -0
  298. package/lib/rtp/src/rtp/rtx.js.map +1 -1
  299. package/lib/rtp/src/rtp/sendHeaderExtensions.d.ts +36 -0
  300. package/lib/rtp/src/rtp/sendHeaderExtensions.js +85 -0
  301. package/lib/rtp/src/rtp/sendHeaderExtensions.js.map +1 -0
  302. package/lib/rtp/src/srtp/cipher/ctr.d.ts +2 -2
  303. package/lib/rtp/src/srtp/cipher/ctr.js +5 -3
  304. package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
  305. package/lib/rtp/src/srtp/cipher/gcm.d.ts +1 -1
  306. package/lib/rtp/src/srtp/cipher/gcm.js +1 -1
  307. package/lib/rtp/src/srtp/cipher/gcm.js.map +1 -1
  308. package/lib/rtp/src/srtp/cipher/index.js +8 -4
  309. package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
  310. package/lib/rtp/src/srtp/context/context.d.ts +29 -1
  311. package/lib/rtp/src/srtp/context/context.js +84 -27
  312. package/lib/rtp/src/srtp/context/context.js.map +1 -1
  313. package/lib/rtp/src/srtp/context/srtcp.d.ts +1 -1
  314. package/lib/rtp/src/srtp/context/srtcp.js +33 -0
  315. package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
  316. package/lib/rtp/src/srtp/context/srtp.d.ts +1 -1
  317. package/lib/rtp/src/srtp/context/srtp.js +36 -4
  318. package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
  319. package/lib/rtp/src/srtp/error.d.ts +8 -0
  320. package/lib/rtp/src/srtp/error.js +13 -1
  321. package/lib/rtp/src/srtp/error.js.map +1 -1
  322. package/lib/rtp/src/srtp/packet.js +4 -1
  323. package/lib/rtp/src/srtp/packet.js.map +1 -1
  324. package/lib/rtp/src/srtp/replay.d.ts +24 -0
  325. package/lib/rtp/src/srtp/replay.js +75 -0
  326. package/lib/rtp/src/srtp/replay.js.map +1 -0
  327. package/lib/rtp/src/srtp/session.js +2 -1
  328. package/lib/rtp/src/srtp/session.js.map +1 -1
  329. package/lib/rtp/src/srtp/srtcp.js +2 -1
  330. package/lib/rtp/src/srtp/srtcp.js.map +1 -1
  331. package/lib/rtp/src/srtp/srtp.js +2 -1
  332. package/lib/rtp/src/srtp/srtp.js.map +1 -1
  333. package/lib/rtp/src/util.js +2 -1
  334. package/lib/rtp/src/util.js.map +1 -1
  335. package/lib/sctp/src/chunk.d.ts +5 -0
  336. package/lib/sctp/src/chunk.js +31 -8
  337. package/lib/sctp/src/chunk.js.map +1 -1
  338. package/lib/sctp/src/const.d.ts +25 -17
  339. package/lib/sctp/src/const.js +23 -19
  340. package/lib/sctp/src/const.js.map +1 -1
  341. package/lib/sctp/src/index.d.ts +4 -3
  342. package/lib/sctp/src/index.js +10 -8
  343. package/lib/sctp/src/index.js.map +1 -1
  344. package/lib/sctp/src/param.d.ts +6 -2
  345. package/lib/sctp/src/param.js +22 -8
  346. package/lib/sctp/src/param.js.map +1 -1
  347. package/lib/sctp/src/sctp.d.ts +91 -2
  348. package/lib/sctp/src/sctp.js +700 -134
  349. package/lib/sctp/src/sctp.js.map +1 -1
  350. package/lib/sctp/src/transport.js +4 -2
  351. package/lib/sctp/src/transport.js.map +1 -1
  352. package/lib/webrtc/src/api/peerConfig.d.ts +307 -0
  353. package/lib/webrtc/src/api/peerConfig.js +291 -0
  354. package/lib/webrtc/src/api/peerConfig.js.map +1 -0
  355. package/lib/webrtc/src/api/peerConnectionEvents.d.ts +36 -0
  356. package/lib/webrtc/src/api/peerConnectionEvents.js +44 -0
  357. package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -0
  358. package/lib/webrtc/src/dataChannel.d.ts +11 -1
  359. package/lib/webrtc/src/dataChannel.js +25 -5
  360. package/lib/webrtc/src/dataChannel.js.map +1 -1
  361. package/lib/webrtc/src/index.d.ts +2 -2
  362. package/lib/webrtc/src/index.js +2 -2
  363. package/lib/webrtc/src/index.js.map +1 -1
  364. package/lib/webrtc/src/media/index.d.ts +11 -1
  365. package/lib/webrtc/src/media/index.js +71 -1
  366. package/lib/webrtc/src/media/index.js.map +1 -1
  367. package/lib/webrtc/src/media/receiver/nack.js +5 -5
  368. package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
  369. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +61 -1
  370. package/lib/webrtc/src/media/receiver/receiverTwcc.js +218 -63
  371. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  372. package/lib/webrtc/src/media/router.d.ts +130 -6
  373. package/lib/webrtc/src/media/router.js +325 -29
  374. package/lib/webrtc/src/media/router.js.map +1 -1
  375. package/lib/webrtc/src/media/rtpReceiver.d.ts +137 -14
  376. package/lib/webrtc/src/media/rtpReceiver.js +420 -44
  377. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  378. package/lib/webrtc/src/media/rtpSender.d.ts +232 -65
  379. package/lib/webrtc/src/media/rtpSender.js +784 -448
  380. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  381. package/lib/webrtc/src/media/rtpTransceiver.d.ts +95 -4
  382. package/lib/webrtc/src/media/rtpTransceiver.js +121 -9
  383. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  384. package/lib/webrtc/src/media/sender/bandwidthEstimator.d.ts +249 -0
  385. package/lib/webrtc/src/media/sender/bandwidthEstimator.js +144 -0
  386. package/lib/webrtc/src/media/sender/bandwidthEstimator.js.map +1 -0
  387. package/lib/webrtc/src/media/sender/createBandwidthEstimator.d.ts +20 -0
  388. package/lib/webrtc/src/media/sender/createBandwidthEstimator.js +26 -0
  389. package/lib/webrtc/src/media/sender/createBandwidthEstimator.js.map +1 -0
  390. package/lib/webrtc/src/media/sender/estimatorBinding.d.ts +70 -0
  391. package/lib/webrtc/src/media/sender/estimatorBinding.js +175 -0
  392. package/lib/webrtc/src/media/sender/estimatorBinding.js.map +1 -0
  393. package/lib/webrtc/src/media/sender/estimators/disabledBwe.d.ts +18 -0
  394. package/lib/webrtc/src/media/sender/estimators/disabledBwe.js +44 -0
  395. package/lib/webrtc/src/media/sender/estimators/disabledBwe.js.map +1 -0
  396. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.d.ts +79 -0
  397. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js +289 -0
  398. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js.map +1 -0
  399. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.d.ts +87 -0
  400. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js +429 -0
  401. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js.map +1 -0
  402. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.d.ts +21 -0
  403. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js +84 -0
  404. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js.map +1 -0
  405. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.d.ts +37 -0
  406. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js +74 -0
  407. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js.map +1 -0
  408. package/lib/webrtc/src/media/sender/estimators/gcc/constants.d.ts +383 -0
  409. package/lib/webrtc/src/media/sender/estimators/gcc/constants.js +408 -0
  410. package/lib/webrtc/src/media/sender/estimators/gcc/constants.js.map +1 -0
  411. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.d.ts +406 -0
  412. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js +1391 -0
  413. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js.map +1 -0
  414. package/lib/webrtc/src/media/sender/estimators/gcc/index.d.ts +19 -0
  415. package/lib/webrtc/src/media/sender/estimators/gcc/index.js +75 -0
  416. package/lib/webrtc/src/media/sender/estimators/gcc/index.js.map +1 -0
  417. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.d.ts +68 -0
  418. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js +201 -0
  419. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js.map +1 -0
  420. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.d.ts +26 -0
  421. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js +72 -0
  422. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js.map +1 -0
  423. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.d.ts +41 -0
  424. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js +99 -0
  425. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js.map +1 -0
  426. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.d.ts +247 -0
  427. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js +1042 -0
  428. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js.map +1 -0
  429. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.d.ts +26 -0
  430. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js +132 -0
  431. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js.map +1 -0
  432. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.d.ts +305 -0
  433. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js +1073 -0
  434. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js.map +1 -0
  435. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.d.ts +60 -0
  436. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js +151 -0
  437. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js.map +1 -0
  438. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.d.ts +44 -0
  439. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js +246 -0
  440. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js.map +1 -0
  441. package/lib/webrtc/src/media/sender/estimators/index.d.ts +7 -0
  442. package/lib/webrtc/src/media/sender/estimators/index.js +19 -0
  443. package/lib/webrtc/src/media/sender/estimators/index.js.map +1 -0
  444. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.d.ts +64 -0
  445. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js +216 -0
  446. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js.map +1 -0
  447. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.d.ts +117 -0
  448. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js +250 -0
  449. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js.map +1 -0
  450. package/lib/webrtc/src/media/sender/outgoingQueue.d.ts +40 -0
  451. package/lib/webrtc/src/media/sender/outgoingQueue.js +153 -0
  452. package/lib/webrtc/src/media/sender/outgoingQueue.js.map +1 -0
  453. package/lib/webrtc/src/media/sender/padding.d.ts +45 -0
  454. package/lib/webrtc/src/media/sender/padding.js +134 -0
  455. package/lib/webrtc/src/media/sender/padding.js.map +1 -0
  456. package/lib/webrtc/src/media/sender/pendingRtp.d.ts +35 -0
  457. package/lib/webrtc/src/media/sender/pendingRtp.js +120 -0
  458. package/lib/webrtc/src/media/sender/pendingRtp.js.map +1 -0
  459. package/lib/webrtc/src/media/sender/rtpWire.d.ts +13 -0
  460. package/lib/webrtc/src/media/sender/rtpWire.js +38 -0
  461. package/lib/webrtc/src/media/sender/rtpWire.js.map +1 -0
  462. package/lib/webrtc/src/media/sender/sendPacer.d.ts +27 -0
  463. package/lib/webrtc/src/media/sender/sendPacer.js +110 -0
  464. package/lib/webrtc/src/media/sender/sendPacer.js.map +1 -0
  465. package/lib/webrtc/src/media/sender/senderBWE.d.ts +8 -32
  466. package/lib/webrtc/src/media/sender/senderBWE.js +5 -142
  467. package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
  468. package/lib/webrtc/src/media/sender/senderStats.d.ts +100 -0
  469. package/lib/webrtc/src/media/sender/senderStats.js +322 -0
  470. package/lib/webrtc/src/media/sender/senderStats.js.map +1 -0
  471. package/lib/webrtc/src/media/track.d.ts +21 -3
  472. package/lib/webrtc/src/media/track.js +24 -6
  473. package/lib/webrtc/src/media/track.js.map +1 -1
  474. package/lib/webrtc/src/negotiation/bundleTopology.d.ts +103 -0
  475. package/lib/webrtc/src/negotiation/bundleTopology.js +384 -0
  476. package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -0
  477. package/lib/webrtc/src/negotiation/descriptionValidation.d.ts +51 -0
  478. package/lib/webrtc/src/negotiation/descriptionValidation.js +267 -0
  479. package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -0
  480. package/lib/webrtc/src/negotiation/iceRestartRequest.d.ts +21 -0
  481. package/lib/webrtc/src/negotiation/iceRestartRequest.js +61 -0
  482. package/lib/webrtc/src/negotiation/iceRestartRequest.js.map +1 -0
  483. package/lib/webrtc/src/negotiation/internalState.d.ts +34 -0
  484. package/lib/webrtc/src/negotiation/internalState.js +21 -0
  485. package/lib/webrtc/src/negotiation/internalState.js.map +1 -0
  486. package/lib/webrtc/src/negotiation/negotiationNeeded.d.ts +44 -0
  487. package/lib/webrtc/src/negotiation/negotiationNeeded.js +119 -0
  488. package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -0
  489. package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +86 -0
  490. package/lib/webrtc/src/negotiation/remoteCandidates.js +349 -0
  491. package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -0
  492. package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +71 -0
  493. package/lib/webrtc/src/negotiation/remoteMediaApplication.js +414 -0
  494. package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -0
  495. package/lib/webrtc/src/negotiation/transportActivation.d.ts +59 -0
  496. package/lib/webrtc/src/negotiation/transportActivation.js +356 -0
  497. package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -0
  498. package/lib/webrtc/src/negotiationTransaction.d.ts +240 -0
  499. package/lib/webrtc/src/negotiationTransaction.js +604 -0
  500. package/lib/webrtc/src/negotiationTransaction.js.map +1 -0
  501. package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
  502. package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
  503. package/lib/webrtc/src/nonstandard/index.d.ts +1 -1
  504. package/lib/webrtc/src/nonstandard/index.js +1 -1
  505. package/lib/webrtc/src/nonstandard/index.js.map +1 -1
  506. package/lib/webrtc/src/nonstandard/navigator.js +4 -3
  507. package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
  508. package/lib/webrtc/src/nonstandard/recorder/index.d.ts +32 -8
  509. package/lib/webrtc/src/nonstandard/recorder/index.js +81 -20
  510. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  511. package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +10 -8
  512. package/lib/webrtc/src/nonstandard/recorder/writer/index.js +2 -1
  513. package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
  514. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.d.ts +32 -0
  515. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js +185 -0
  516. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js.map +1 -0
  517. package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
  518. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +10 -3
  519. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  520. package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +2 -2
  521. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
  522. package/lib/webrtc/src/nonstandard/userMedia.d.ts +2 -2
  523. package/lib/webrtc/src/nonstandard/userMedia.js +4 -3
  524. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  525. package/lib/webrtc/src/peerConnection.d.ts +176 -238
  526. package/lib/webrtc/src/peerConnection.js +1042 -913
  527. package/lib/webrtc/src/peerConnection.js.map +1 -1
  528. package/lib/webrtc/src/polyfill/api.d.ts +5 -5
  529. package/lib/webrtc/src/polyfill/api.js.map +1 -1
  530. package/lib/webrtc/src/polyfill/index.js.map +1 -1
  531. package/lib/webrtc/src/polyfill/install.js +1 -1
  532. package/lib/webrtc/src/polyfill/install.js.map +1 -1
  533. package/lib/webrtc/src/polyfill/mediaDevices.js +2 -1
  534. package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
  535. package/lib/webrtc/src/polyfill/registers/mp4Webm.js.map +1 -1
  536. package/lib/webrtc/src/polyfill/registers/rtpRtcp.js.map +1 -1
  537. package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
  538. package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
  539. package/lib/webrtc/src/sctpManager.d.ts +97 -1
  540. package/lib/webrtc/src/sctpManager.js +189 -9
  541. package/lib/webrtc/src/sctpManager.js.map +1 -1
  542. package/lib/webrtc/src/sdp.js +12 -6
  543. package/lib/webrtc/src/sdp.js.map +1 -1
  544. package/lib/webrtc/src/sdpManager.d.ts +55 -11
  545. package/lib/webrtc/src/sdpManager.js +364 -87
  546. package/lib/webrtc/src/sdpManager.js.map +1 -1
  547. package/lib/webrtc/src/secureTransportManager.d.ts +89 -28
  548. package/lib/webrtc/src/secureTransportManager.js +232 -53
  549. package/lib/webrtc/src/secureTransportManager.js.map +1 -1
  550. package/lib/webrtc/src/transceiverManager.d.ts +62 -18
  551. package/lib/webrtc/src/transceiverManager.js +272 -107
  552. package/lib/webrtc/src/transceiverManager.js.map +1 -1
  553. package/lib/webrtc/src/transport/dtls.d.ts +64 -3
  554. package/lib/webrtc/src/transport/dtls.js +166 -42
  555. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  556. package/lib/webrtc/src/transport/ice.d.ts +199 -28
  557. package/lib/webrtc/src/transport/ice.js +666 -71
  558. package/lib/webrtc/src/transport/ice.js.map +1 -1
  559. package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +98 -0
  560. package/lib/webrtc/src/transport/iceCandidateAttribute.js +129 -0
  561. package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -0
  562. package/lib/webrtc/src/transport/sctp.d.ts +6 -1
  563. package/lib/webrtc/src/transport/sctp.js +149 -37
  564. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  565. package/lib/webrtc/src/utils.d.ts +39 -6
  566. package/lib/webrtc/src/utils.js +57 -17
  567. package/lib/webrtc/src/utils.js.map +1 -1
  568. package/package.json +16 -15
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BandwidthEstimatorNoopHooks = void 0;
4
+ exports.isProbePacingController = isProbePacingController;
5
+ exports.needsPacedSendPath = needsPacedSendPath;
6
+ exports.isRoundTripTimeConsumer = isRoundTripTimeConsumer;
7
+ exports.isNetworkAvailabilityConsumer = isNetworkAvailabilityConsumer;
8
+ exports.isBandwidthEstimatorProcessor = isBandwidthEstimatorProcessor;
9
+ exports.setAvailableBitrateIfChanged = setAvailableBitrateIfChanged;
10
+ const common_1 = require("../../imports/common");
11
+ /**
12
+ * True when the estimator actually drives probe padding (non-zero padding size).
13
+ * Lightweight / disabled no-ops return false.
14
+ */
15
+ function isProbePacingController(e) {
16
+ return e.probePaddingPacketBytes > 0;
17
+ }
18
+ /**
19
+ * True when the estimator needs the sender's paced send FIFO: a process
20
+ * timer (GCC) or probe padding. Lightweight / disabled return false, and
21
+ * {@link RTCRtpSender} then writes RTP straight through without consulting the
22
+ * pacing / probe hooks (same send path as before the BWE abstraction).
23
+ */
24
+ function needsPacedSendPath(e) {
25
+ return e.processIntervalMs > 0 || e.probePaddingPacketBytes > 0;
26
+ }
27
+ /**
28
+ * True when the estimator consumes RTCP RTT for AIMD (non-zero process interval).
29
+ * Lightweight / disabled `setRoundTripTime` is a no-op.
30
+ */
31
+ function isRoundTripTimeConsumer(e) {
32
+ return e.processIntervalMs > 0;
33
+ }
34
+ function isNetworkAvailabilityConsumer(e) {
35
+ return e.processIntervalMs > 0;
36
+ }
37
+ /** True when the sender should run a process timer (`processIntervalMs > 0`). */
38
+ function isBandwidthEstimatorProcessor(e) {
39
+ return e.processIntervalMs > 0;
40
+ }
41
+ /**
42
+ * Shared no-op implementations of GCC send-path hooks.
43
+ * {@link LightweightBandwidthEstimator} and {@link DisabledBandwidthEstimator} extend this.
44
+ */
45
+ class BandwidthEstimatorNoopHooks {
46
+ constructor() {
47
+ Object.defineProperty(this, "processIntervalMs", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: 0
52
+ });
53
+ Object.defineProperty(this, "probePaddingPacketBytes", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: 0
58
+ });
59
+ Object.defineProperty(this, "probePaddingMaxBurst", {
60
+ enumerable: true,
61
+ configurable: true,
62
+ writable: true,
63
+ value: 0
64
+ });
65
+ Object.defineProperty(this, "onProbeClusterConfig", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: new common_1.Event()
70
+ });
71
+ /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
72
+ Object.defineProperty(this, "onCongestion", {
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true,
76
+ value: new common_1.Event()
77
+ });
78
+ /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */
79
+ Object.defineProperty(this, "onCongestionScore", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: new common_1.Event()
84
+ });
85
+ /** @deprecated Always false except on {@link LightweightBandwidthEstimator}. */
86
+ Object.defineProperty(this, "congestion", {
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true,
90
+ value: false
91
+ });
92
+ Object.defineProperty(this, "_compatCongestionScore", {
93
+ enumerable: true,
94
+ configurable: true,
95
+ writable: true,
96
+ value: 1
97
+ });
98
+ }
99
+ /** @deprecated Always 1 except on {@link LightweightBandwidthEstimator}. */
100
+ get congestionScore() {
101
+ return this._compatCongestionScore;
102
+ }
103
+ shouldTagProbePacket() {
104
+ return false;
105
+ }
106
+ getPacingBitrateBps() {
107
+ return 0;
108
+ }
109
+ reserveOutgoingProbe(_nowMs) {
110
+ return undefined;
111
+ }
112
+ pendingProbePaddingPackets(_packetBytes) {
113
+ return 0;
114
+ }
115
+ getPaddingBitrateBps() {
116
+ return 0;
117
+ }
118
+ pendingLossPaddingPackets(_packetBytes) {
119
+ return 0;
120
+ }
121
+ setRoundTripTime(_rttMs) { }
122
+ setNetworkAvailable(_available) { }
123
+ process(_nowMs) { }
124
+ disposeNoopHooks() {
125
+ this.onProbeClusterConfig.allUnsubscribe();
126
+ this.onCongestion.allUnsubscribe();
127
+ this.onCongestionScore.allUnsubscribe();
128
+ }
129
+ }
130
+ exports.BandwidthEstimatorNoopHooks = BandwidthEstimatorNoopHooks;
131
+ /**
132
+ * Helper for concrete estimators: assign `availableBitrate` only when it changes
133
+ * and notify `onAvailableBitrate` with the new value in bps.
134
+ */
135
+ function setAvailableBitrateIfChanged(target, nextBps) {
136
+ const v = Math.max(0, Math.round(nextBps));
137
+ if (v === target._availableBitrate) {
138
+ return false;
139
+ }
140
+ target._availableBitrate = v;
141
+ target.onAvailableBitrate.execute(v);
142
+ return true;
143
+ }
144
+ //# sourceMappingURL=bandwidthEstimator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bandwidthEstimator.js","sourceRoot":"","sources":["../../../../../src/media/sender/bandwidthEstimator.ts"],"names":[],"mappings":";;;AA6MA,0DAIC;AAQD,gDAEC;AAYD,0DAIC;AAQD,sEAIC;AAMD,sEAIC;AAmFD,oEAcC;AAlWD,iDAA6C;AAyM7C;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,CAAqB;IAErB,OAAO,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,CAAqB;IACtD,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC;AAClE,CAAC;AAQD;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAQD,SAAgB,6BAA6B,CAC3C,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAKD,iFAAiF;AACjF,SAAgB,6BAA6B,CAC3C,CAAqB;IAErB,OAAO,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;AACjC,CAAC;AAqBD;;;GAGG;AACH,MAAsB,2BAA2B;IAAjD;QACW;;;;mBAAoB,CAAC;WAAC;QACtB;;;;mBAA0B,CAAC;WAAC;QAC5B;;;;mBAAuB,CAAC;WAAC;QACzB;;;;mBAAuB,IAAI,cAAK,EAAwB;WAAC;QAClE,yEAAyE;QAChE;;;;mBAAe,IAAI,cAAK,EAAa;WAAC;QAC/C,yEAAyE;QAChE;;;;mBAAoB,IAAI,cAAK,EAAY;WAAC;QACnD,gFAAgF;QAChF;;;;mBAAa,KAAK;WAAC;QACT;;;;mBAAyB,CAAC;WAAC;IAyCvC,CAAC;IAxCC,4EAA4E;IAC5E,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED,oBAAoB;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,mBAAmB;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0BAA0B,CAAC,YAAqB;QAC9C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,yBAAyB,CAAC,YAAqB;QAC7C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,gBAAgB,CAAC,MAAc,IAAS,CAAC;IAEzC,mBAAmB,CAAC,UAAmB,IAAS,CAAC;IAEjD,OAAO,CAAC,MAAc,IAAS,CAAC;IAEtB,gBAAgB;QACxB,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;QACnC,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;CACF;AApDD,kEAoDC;AAED;;;GAGG;AACH,SAAgB,4BAA4B,CAC1C,MAGC,EACD,OAAe;IAEf,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Event } from \"../../imports/common\";\nimport type { TransportWideCC } from \"../../imports/rtp\";\n\n/**\n * Sent RTP packet observation used as input to send-side BWE algorithms.\n * Transport-wide sequence numbers come from the shared DTLS transport clock.\n */\nexport interface SentInfo {\n /**\n * Transport-wide sequence: monotonic extended value from\n * {@link RTCDtlsTransport.transportSequenceNumberExtended} (wire is low 16 bits).\n */\n wideSeq: number;\n /** Packet size in bytes (on-wire after SRTP when measured by the sender). */\n size: number;\n /** Optional flag for probe / probation packets used by some estimators (e.g. GCC). */\n isProbation?: boolean;\n /**\n * pin `PacedPacketInfo.probe_cluster_id` reserved **before** send.\n * ProbeController must attribute this packet to this cluster, not\n * whatever is current when the async send completes.\n */\n probeClusterId?: number;\n /**\n * pin `SentPacket.prior_unacked_data` — untracked bytes attributed to\n * the next TWCC-tracked packet (RobustThroughputEstimator).\n */\n priorUnackedBytes?: number;\n /** True when this packet is an RTX / retransmission. */\n isRetransmission?: boolean;\n /** Wall-clock send time in milliseconds. */\n sendingAtMs: number;\n /** Wall-clock time when the send completed in milliseconds. */\n sentAtMs: number;\n}\n\n/**\n * Probe cluster the sender should temporarily aim for (padding / encoder ramp).\n * GCC fires {@link BandwidthEstimator.onProbeClusterConfig} with this payload;\n * lightweight / disabled estimators never emit it.\n */\nexport interface ProbeClusterConfig {\n id: number;\n /** Target bitrate the pacer / sender should temporarily aim for (bps). */\n targetBps: number;\n minPackets: number;\n minDurationMs: number;\n /** Minimum bytes expected for the cluster (for receive-ratio checks). */\n minBytes: number;\n /**\n * pin `ProbeClusterConfig.min_probe_delta` (ms). Used for\n * RecommendedMinProbeSize and stored on the BitrateProber cluster.\n */\n minProbeDeltaMs: number;\n /** pin `requested_at` — queue age for the 5s queued-cluster timeout. */\n requestedAtMs: number;\n}\n\n/** Reservation taken **before** the async send (pin `CurrentCluster`). */\nexport interface ProbeReservation {\n clusterId: number;\n /** Next allowed send time (MinusInfinity → send immediately). */\n nextSendTimeMs: number;\n}\n\n/**\n * Common contract for send-side bandwidth estimators driven by TWCC feedback.\n *\n * TWCC I/O and recommended bitrate (`rtpPacketSent` / `receiveTWCC` /\n * `availableBitrate` / `onAvailableBitrate`) are required. GCC also needs\n * probe / pacing / RTT / process-interval hooks; those live on this same\n * interface so {@link RTCRtpSender} does not import GCC. Lightweight and disabled\n * estimators implement them as no-ops (`processIntervalMs === 0`, padding\n * sizes 0, methods return false / 0 / undefined).\n */\nexport interface BandwidthEstimator {\n /**\n * Recommended / estimated available send bitrate in **bps**.\n * May remain `0` until TWCC is negotiated and enough samples are collected.\n */\n readonly availableBitrate: number;\n\n /**\n * Fires when the recommended send bitrate (**bps**) **changes**.\n * Unit is always bits per second (bps). Change-only (not every recompute).\n */\n readonly onAvailableBitrate: Event<[number]>;\n\n /**\n * Fires when a probe cluster is activated. Lightweight / disabled never fire.\n */\n readonly onProbeClusterConfig: Event<[ProbeClusterConfig]>;\n\n /** Record an outgoing RTP packet for later matching against TWCC feedback. */\n rtpPacketSent(info: SentInfo): void;\n\n /** Process a Transport-Wide CC RTCP feedback packet and update the estimate. */\n receiveTWCC(feedback: TransportWideCC): void;\n\n /** Clear internal history / estimates. */\n reset?(): void;\n\n /**\n * The sender moved to another network route (DTLS transport): clear the\n * path-dependent state (send history, TSN origin, estimates, probing) but\n * keep application configuration such as bitrate constraints\n * (pin `OnNetworkRouteChange`). {@link RTCRtpSender} falls back to\n * {@link reset} when an estimator does not implement this.\n */\n resetNetworkRoute?(): void;\n\n /**\n * Release listeners / timers when the sender replaces the estimator.\n * {@link RTCRtpSender} rebinds its stable `onAvailableBitrate` bridge after dispose.\n */\n dispose?(): void;\n\n /**\n * Sender-clock process interval in milliseconds (pin GoogCc 25ms).\n * `0` — do not run a process timer (lightweight / disabled).\n */\n readonly processIntervalMs: number;\n\n /**\n * RTP padding size used when the sender injects probe / loss padding.\n * `0` — do not inject padding (lightweight / disabled).\n */\n readonly probePaddingPacketBytes: number;\n\n /**\n * Max padding packets per inner send burst. `0` when padding is disabled.\n */\n readonly probePaddingMaxBurst: number;\n\n /** Tag the next outgoing packet as a probe (`SentInfo.isProbation`). */\n shouldTagProbePacket(): boolean;\n\n /**\n * Pacing target (bps) for the send engine.\n * pin GetPacingRates: estimate × 2.5 before first TWCC, × 1.1 after,\n * raised to the active probe target while probing.\n * `0` — do not token-bucket pace (lightweight / disabled).\n */\n getPacingBitrateBps(): number;\n\n /**\n * pin `BitrateProber::CurrentCluster` — reserve the active probe cluster\n * **before** the packet is sent (not at send-complete callback).\n */\n reserveOutgoingProbe(nowMs: number): ProbeReservation | undefined;\n\n /**\n * Number of padding packets the sender should inject to fill the active\n * probe cluster when media alone is insufficient.\n */\n pendingProbePaddingPackets(packetBytes?: number): number;\n\n /**\n * pin `GetPacingRates` padding_rate while loss-limited\n * `kIncreaseUsingPadding`. 0 when not in that state.\n */\n getPaddingBitrateBps(): number;\n\n /**\n * Padding packets to send to approach {@link getPaddingBitrateBps} when\n * media is sparse. Not probe/probation packets.\n */\n pendingLossPaddingPackets(packetBytes?: number): number;\n\n /**\n * Raw round-trip time in **milliseconds** (not TWCC propagation RTT).\n * Pin GoogCc ignores smoothed RTT and only applies unsmoothed updates.\n */\n setRoundTripTime(rttMs: number): void;\n\n /** True when ICE/DTLS (or equivalent) can emit RTP. */\n setNetworkAvailable(available: boolean): void;\n\n /**\n * Advance sender-clock estimator state at `nowMs` (milliseconds).\n * Does not count as a sent packet — CorrectedRtt timeout only grows on\n * `rtpPacketSent`.\n */\n process(nowMs: number): void;\n}\n\n/**\n * GCC-oriented probe / pacing subset of {@link BandwidthEstimator}.\n * Lightweight implements these as no-ops; use {@link isProbePacingController} to\n * detect an estimator that actually injects probe padding.\n */\nexport type ProbePacingController = Pick<\n BandwidthEstimator,\n | \"shouldTagProbePacket\"\n | \"getPacingBitrateBps\"\n | \"reserveOutgoingProbe\"\n | \"pendingProbePaddingPackets\"\n | \"getPaddingBitrateBps\"\n | \"pendingLossPaddingPackets\"\n>;\n\n/**\n * True when the estimator actually drives probe padding (non-zero padding size).\n * Lightweight / disabled no-ops return false.\n */\nexport function isProbePacingController(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & ProbePacingController {\n return e.probePaddingPacketBytes > 0;\n}\n\n/**\n * True when the estimator needs the sender's paced send FIFO: a process\n * timer (GCC) or probe padding. Lightweight / disabled return false, and\n * {@link RTCRtpSender} then writes RTP straight through without consulting the\n * pacing / probe hooks (same send path as before the BWE abstraction).\n */\nexport function needsPacedSendPath(e: BandwidthEstimator): boolean {\n return e.processIntervalMs > 0 || e.probePaddingPacketBytes > 0;\n}\n\n/** RTCP / network RTT consumer (pin OnRoundTripTimeUpdate). */\nexport type RoundTripTimeConsumer = Pick<\n BandwidthEstimator,\n \"setRoundTripTime\"\n>;\n\n/**\n * True when the estimator consumes RTCP RTT for AIMD (non-zero process interval).\n * Lightweight / disabled `setRoundTripTime` is a no-op.\n */\nexport function isRoundTripTimeConsumer(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & RoundTripTimeConsumer {\n return e.processIntervalMs > 0;\n}\n\n/** pin `OnNetworkAvailability` consumer. */\nexport type NetworkAvailabilityConsumer = Pick<\n BandwidthEstimator,\n \"setNetworkAvailable\"\n>;\n\nexport function isNetworkAvailabilityConsumer(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & NetworkAvailabilityConsumer {\n return e.processIntervalMs > 0;\n}\n\n/** pin GoogCc `OnProcessInterval` surface. */\nexport type BandwidthEstimatorProcessor = Pick<BandwidthEstimator, \"process\">;\n\n/** True when the sender should run a process timer (`processIntervalMs > 0`). */\nexport function isBandwidthEstimatorProcessor(\n e: BandwidthEstimator,\n): e is BandwidthEstimator & BandwidthEstimatorProcessor {\n return e.processIntervalMs > 0;\n}\n\n/**\n * Congestion events kept on every estimator instance so\n * `sender.senderBWE.onCongestion` still type-checks after the BWE abstraction.\n * Only {@link LightweightBandwidthEstimator} fires them; GCC / disabled are no-ops.\n *\n * Not part of {@link BandwidthEstimator}. Prefer a `LightweightBandwidthEstimator`\n * assertion for new code. This surface may be removed in a future major.\n */\nexport type CongestionEventsCompatibility = {\n /** @deprecated Lightweight-only. No-op on GCC / disabled. */\n readonly onCongestion: Event<[boolean]>;\n /** @deprecated Lightweight-only. No-op on GCC / disabled. */\n readonly onCongestionScore: Event<[number]>;\n /** @deprecated Lightweight-only. Always false on GCC / disabled. */\n congestion: boolean;\n /** @deprecated Lightweight-only. Always 1 on GCC / disabled. */\n congestionScore: number;\n};\n\n/**\n * Shared no-op implementations of GCC send-path hooks.\n * {@link LightweightBandwidthEstimator} and {@link DisabledBandwidthEstimator} extend this.\n */\nexport abstract class BandwidthEstimatorNoopHooks {\n readonly processIntervalMs = 0;\n readonly probePaddingPacketBytes = 0;\n readonly probePaddingMaxBurst = 0;\n readonly onProbeClusterConfig = new Event<[ProbeClusterConfig]>();\n /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */\n readonly onCongestion = new Event<[boolean]>();\n /** @deprecated No-op except on {@link LightweightBandwidthEstimator}. */\n readonly onCongestionScore = new Event<[number]>();\n /** @deprecated Always false except on {@link LightweightBandwidthEstimator}. */\n congestion = false;\n protected _compatCongestionScore = 1;\n /** @deprecated Always 1 except on {@link LightweightBandwidthEstimator}. */\n get congestionScore() {\n return this._compatCongestionScore;\n }\n\n shouldTagProbePacket(): boolean {\n return false;\n }\n\n getPacingBitrateBps(): number {\n return 0;\n }\n\n reserveOutgoingProbe(_nowMs: number): ProbeReservation | undefined {\n return undefined;\n }\n\n pendingProbePaddingPackets(_packetBytes?: number): number {\n return 0;\n }\n\n getPaddingBitrateBps(): number {\n return 0;\n }\n\n pendingLossPaddingPackets(_packetBytes?: number): number {\n return 0;\n }\n\n setRoundTripTime(_rttMs: number): void {}\n\n setNetworkAvailable(_available: boolean): void {}\n\n process(_nowMs: number): void {}\n\n protected disposeNoopHooks(): void {\n this.onProbeClusterConfig.allUnsubscribe();\n this.onCongestion.allUnsubscribe();\n this.onCongestionScore.allUnsubscribe();\n }\n}\n\n/**\n * Helper for concrete estimators: assign `availableBitrate` only when it changes\n * and notify `onAvailableBitrate` with the new value in bps.\n */\nexport function setAvailableBitrateIfChanged(\n target: {\n _availableBitrate: number;\n onAvailableBitrate: Event<[number]>;\n },\n nextBps: number,\n): boolean {\n const v = Math.max(0, Math.round(nextBps));\n if (v === target._availableBitrate) {\n return false;\n }\n target._availableBitrate = v;\n target.onAvailableBitrate.execute(v);\n return true;\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { BandwidthEstimator } from "./bandwidthEstimator";
2
+ /**
3
+ * Named presets for {@link PeerConfig.bandwidthEstimator}.
4
+ * `"lightweight"` is the default (the existing estimator, backward compatible).
5
+ */
6
+ export type BandwidthEstimatorPreset = "lightweight" | "gcc" | "none";
7
+ /**
8
+ * How a new {@link RTCRtpSender} obtains its {@link BandwidthEstimator}.
9
+ *
10
+ * - `"lightweight"` (default): {@link LightweightBandwidthEstimator}
11
+ * - `"gcc"`: {@link GccBandwidthEstimator}
12
+ * - `false` / `"none"`: {@link DisabledBandwidthEstimator}
13
+ * - factory: called **once per sender** (do not share one instance)
14
+ */
15
+ export type BandwidthEstimatorOption = BandwidthEstimatorPreset | false | (() => BandwidthEstimator);
16
+ /**
17
+ * Construct a send-side estimator from a {@link BandwidthEstimatorOption}.
18
+ * Each {@link RTCRtpSender} must get its own instance.
19
+ */
20
+ export declare function createBandwidthEstimator(option?: BandwidthEstimatorOption | undefined): BandwidthEstimator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBandwidthEstimator = createBandwidthEstimator;
4
+ const disabledBwe_1 = require("./estimators/disabledBwe");
5
+ const gccBwe_1 = require("./estimators/gcc/gccBwe");
6
+ const lightweightBwe_1 = require("./estimators/lightweightBwe");
7
+ /**
8
+ * Construct a send-side estimator from a {@link BandwidthEstimatorOption}.
9
+ * Each {@link RTCRtpSender} must get its own instance.
10
+ */
11
+ function createBandwidthEstimator(option = "lightweight") {
12
+ if (option === undefined || option === "lightweight") {
13
+ return new lightweightBwe_1.LightweightBandwidthEstimator();
14
+ }
15
+ if (option === false || option === "none") {
16
+ return new disabledBwe_1.DisabledBandwidthEstimator();
17
+ }
18
+ if (option === "gcc") {
19
+ return new gccBwe_1.GccBandwidthEstimator();
20
+ }
21
+ if (typeof option === "function") {
22
+ return option();
23
+ }
24
+ throw new TypeError(`unsupported bandwidthEstimator option: ${String(option)}`);
25
+ }
26
+ //# sourceMappingURL=createBandwidthEstimator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createBandwidthEstimator.js","sourceRoot":"","sources":["../../../../../src/media/sender/createBandwidthEstimator.ts"],"names":[],"mappings":";;AA4BA,4DAkBC;AA7CD,0DAAsE;AACtE,oDAAgE;AAChE,gEAA4E;AAqB5E;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,SAA+C,aAAa;IAE5D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;QACrD,OAAO,IAAI,8CAA6B,EAAE,CAAC;IAC7C,CAAC;IACD,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1C,OAAO,IAAI,wCAA0B,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,IAAI,8BAAqB,EAAE,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,0CAA0C,MAAM,CAAC,MAAM,CAAC,EAAE,CAC3D,CAAC;AACJ,CAAC","sourcesContent":["import type { BandwidthEstimator } from \"./bandwidthEstimator\";\nimport { DisabledBandwidthEstimator } from \"./estimators/disabledBwe\";\nimport { GccBandwidthEstimator } from \"./estimators/gcc/gccBwe\";\nimport { LightweightBandwidthEstimator } from \"./estimators/lightweightBwe\";\n\n/**\n * Named presets for {@link PeerConfig.bandwidthEstimator}.\n * `\"lightweight\"` is the default (the existing estimator, backward compatible).\n */\nexport type BandwidthEstimatorPreset = \"lightweight\" | \"gcc\" | \"none\";\n\n/**\n * How a new {@link RTCRtpSender} obtains its {@link BandwidthEstimator}.\n *\n * - `\"lightweight\"` (default): {@link LightweightBandwidthEstimator}\n * - `\"gcc\"`: {@link GccBandwidthEstimator}\n * - `false` / `\"none\"`: {@link DisabledBandwidthEstimator}\n * - factory: called **once per sender** (do not share one instance)\n */\nexport type BandwidthEstimatorOption =\n | BandwidthEstimatorPreset\n | false\n | (() => BandwidthEstimator);\n\n/**\n * Construct a send-side estimator from a {@link BandwidthEstimatorOption}.\n * Each {@link RTCRtpSender} must get its own instance.\n */\nexport function createBandwidthEstimator(\n option: BandwidthEstimatorOption | undefined = \"lightweight\",\n): BandwidthEstimator {\n if (option === undefined || option === \"lightweight\") {\n return new LightweightBandwidthEstimator();\n }\n if (option === false || option === \"none\") {\n return new DisabledBandwidthEstimator();\n }\n if (option === \"gcc\") {\n return new GccBandwidthEstimator();\n }\n if (typeof option === \"function\") {\n return option();\n }\n throw new TypeError(\n `unsupported bandwidthEstimator option: ${String(option)}`,\n );\n}\n"]}
@@ -0,0 +1,70 @@
1
+ import type { BandwidthEstimator, ProbeClusterConfig } from "./bandwidthEstimator";
2
+ /** What the binding reports back to its {@link RTCRtpSender}. */
3
+ export type EstimatorBindingHooks = {
4
+ /** The active estimator changed its recommended bitrate (bps). */
5
+ onAvailableBitrate: (bps: number) => void;
6
+ /** The active estimator activated a probe cluster. */
7
+ onProbeClusterConfig: (cfg: ProbeClusterConfig) => void;
8
+ /** After each process tick (pin GetPacingRates padding_rate). */
9
+ onProcessTick: () => void;
10
+ /** The sender is stopped: the process timer neither starts nor ticks. */
11
+ isStopped: () => boolean;
12
+ };
13
+ /**
14
+ * The send-side bandwidth estimator of one {@link RTCRtpSender} and
15
+ * everything tied to its lifetime: the event bridges to the sender, the
16
+ * process timer, and the **generation**.
17
+ *
18
+ * The generation is bumped whenever the estimator is replaced, reset for a
19
+ * new transport, or the sender stops. A send or padding drain captures it at
20
+ * start and drops its estimator delivery when it no longer matches, so a
21
+ * packet planned under the old estimator cannot pollute the new clean one or
22
+ * revive a disposed probe controller. {@link generationSignal} aborts at the
23
+ * same moment to release waits running at the old estimator's rate.
24
+ */
25
+ export declare class EstimatorBinding {
26
+ private readonly hooks;
27
+ private current;
28
+ private _generation;
29
+ private generationCancel;
30
+ private unsubscribeAvailableBitrate?;
31
+ private unsubscribeProbeClusterConfig?;
32
+ /** Interval from {@link BandwidthEstimator.processIntervalMs} (0 = none). */
33
+ private processTimer?;
34
+ constructor(initial: BandwidthEstimator, hooks: EstimatorBindingHooks);
35
+ get estimator(): BandwidthEstimator;
36
+ get generation(): number;
37
+ /** Aborted on the next generation bump. */
38
+ get generationSignal(): AbortSignal;
39
+ /** Invalidate sends planned under the current estimator and release their waits. */
40
+ bumpGeneration(): void;
41
+ /**
42
+ * Make `impl` the active estimator with a clean state: bump the
43
+ * generation, release the previous instance (`dispose()`, else `reset()`)
44
+ * and always `reset()` `impl`, so a previously used instance does not merge
45
+ * old state. The same instance is only reset.
46
+ */
47
+ replace(impl: BandwidthEstimator): void;
48
+ /**
49
+ * A new DTLS transport has its own transport-wide sequence space and path
50
+ * (pin `OnNetworkRouteChanged` resets the controller): drop the path state
51
+ * and keep app-configured constraints
52
+ * ({@link BandwidthEstimator.resetNetworkRoute}, else `reset()`).
53
+ */
54
+ resetForNewRoute(): void;
55
+ /**
56
+ * pin `OnNetworkAvailability` — initial probes wait until DTLS can send.
57
+ * Lightweight / disabled no-op `setNetworkAvailable`.
58
+ */
59
+ syncNetworkAvailability(connected: boolean): void;
60
+ /**
61
+ * (Re)start the process timer for the active estimator (pin
62
+ * `GoogCcNetworkControllerFactory::GetProcessInterval`).
63
+ */
64
+ syncProcessTimer(): void;
65
+ /** Sender stop: no timer, no bridges, estimator released. */
66
+ close(): void;
67
+ private stopProcessTimer;
68
+ private bind;
69
+ private unbind;
70
+ }
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EstimatorBinding = void 0;
4
+ const utils_1 = require("../../utils");
5
+ /**
6
+ * The send-side bandwidth estimator of one {@link RTCRtpSender} and
7
+ * everything tied to its lifetime: the event bridges to the sender, the
8
+ * process timer, and the **generation**.
9
+ *
10
+ * The generation is bumped whenever the estimator is replaced, reset for a
11
+ * new transport, or the sender stops. A send or padding drain captures it at
12
+ * start and drops its estimator delivery when it no longer matches, so a
13
+ * packet planned under the old estimator cannot pollute the new clean one or
14
+ * revive a disposed probe controller. {@link generationSignal} aborts at the
15
+ * same moment to release waits running at the old estimator's rate.
16
+ */
17
+ class EstimatorBinding {
18
+ constructor(initial, hooks) {
19
+ Object.defineProperty(this, "hooks", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: void 0
24
+ });
25
+ Object.defineProperty(this, "current", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ Object.defineProperty(this, "_generation", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: 0
36
+ });
37
+ Object.defineProperty(this, "generationCancel", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: new AbortController()
42
+ });
43
+ Object.defineProperty(this, "unsubscribeAvailableBitrate", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: void 0
48
+ });
49
+ Object.defineProperty(this, "unsubscribeProbeClusterConfig", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: void 0
54
+ });
55
+ /** Interval from {@link BandwidthEstimator.processIntervalMs} (0 = none). */
56
+ Object.defineProperty(this, "processTimer", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: void 0
61
+ });
62
+ this.hooks = hooks;
63
+ this.current = initial;
64
+ this.bind(initial);
65
+ }
66
+ get estimator() {
67
+ return this.current;
68
+ }
69
+ get generation() {
70
+ return this._generation;
71
+ }
72
+ /** Aborted on the next generation bump. */
73
+ get generationSignal() {
74
+ return this.generationCancel.signal;
75
+ }
76
+ /** Invalidate sends planned under the current estimator and release their waits. */
77
+ bumpGeneration() {
78
+ this._generation++;
79
+ this.generationCancel.abort();
80
+ this.generationCancel = new AbortController();
81
+ }
82
+ /**
83
+ * Make `impl` the active estimator with a clean state: bump the
84
+ * generation, release the previous instance (`dispose()`, else `reset()`)
85
+ * and always `reset()` `impl`, so a previously used instance does not merge
86
+ * old state. The same instance is only reset.
87
+ */
88
+ replace(impl) {
89
+ this.bumpGeneration();
90
+ if (impl === this.current) {
91
+ impl.reset?.();
92
+ return;
93
+ }
94
+ this.unbind();
95
+ release(this.current);
96
+ impl.reset?.();
97
+ this.current = impl;
98
+ this.bind(impl);
99
+ }
100
+ /**
101
+ * A new DTLS transport has its own transport-wide sequence space and path
102
+ * (pin `OnNetworkRouteChanged` resets the controller): drop the path state
103
+ * and keep app-configured constraints
104
+ * ({@link BandwidthEstimator.resetNetworkRoute}, else `reset()`).
105
+ */
106
+ resetForNewRoute() {
107
+ this.bumpGeneration();
108
+ const estimator = this.current;
109
+ if (estimator.resetNetworkRoute)
110
+ estimator.resetNetworkRoute();
111
+ else
112
+ estimator.reset?.();
113
+ }
114
+ /**
115
+ * pin `OnNetworkAvailability` — initial probes wait until DTLS can send.
116
+ * Lightweight / disabled no-op `setNetworkAvailable`.
117
+ */
118
+ syncNetworkAvailability(connected) {
119
+ this.current.setNetworkAvailable(connected);
120
+ }
121
+ /**
122
+ * (Re)start the process timer for the active estimator (pin
123
+ * `GoogCcNetworkControllerFactory::GetProcessInterval`).
124
+ */
125
+ syncProcessTimer() {
126
+ this.stopProcessTimer();
127
+ if (this.hooks.isStopped())
128
+ return;
129
+ const intervalMs = this.current.processIntervalMs;
130
+ if (!(intervalMs > 0))
131
+ return;
132
+ const timer = setInterval(() => {
133
+ if (this.hooks.isStopped())
134
+ return;
135
+ this.current.process((0, utils_1.milliTime)());
136
+ this.hooks.onProcessTick();
137
+ }, intervalMs);
138
+ timer.unref?.();
139
+ this.processTimer = timer;
140
+ }
141
+ /** Sender stop: no timer, no bridges, estimator released. */
142
+ close() {
143
+ this.stopProcessTimer();
144
+ this.unbind();
145
+ release(this.current);
146
+ }
147
+ stopProcessTimer() {
148
+ if (this.processTimer !== undefined) {
149
+ clearInterval(this.processTimer);
150
+ this.processTimer = undefined;
151
+ }
152
+ }
153
+ bind(impl) {
154
+ this.unsubscribeAvailableBitrate?.();
155
+ this.unsubscribeAvailableBitrate = impl.onAvailableBitrate.subscribe((bps) => this.hooks.onAvailableBitrate(bps)).unSubscribe;
156
+ this.unsubscribeProbeClusterConfig?.();
157
+ this.unsubscribeProbeClusterConfig = impl.onProbeClusterConfig.subscribe((cfg) => this.hooks.onProbeClusterConfig(cfg)).unSubscribe;
158
+ }
159
+ unbind() {
160
+ this.unsubscribeAvailableBitrate?.();
161
+ this.unsubscribeAvailableBitrate = undefined;
162
+ this.unsubscribeProbeClusterConfig?.();
163
+ this.unsubscribeProbeClusterConfig = undefined;
164
+ }
165
+ }
166
+ exports.EstimatorBinding = EstimatorBinding;
167
+ function release(estimator) {
168
+ if (estimator.dispose) {
169
+ estimator.dispose();
170
+ }
171
+ else {
172
+ estimator.reset?.();
173
+ }
174
+ }
175
+ //# sourceMappingURL=estimatorBinding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimatorBinding.js","sourceRoot":"","sources":["../../../../../src/media/sender/estimatorBinding.ts"],"names":[],"mappings":";;;AAAA,uCAAwC;AAkBxC;;;;;;;;;;;GAWG;AACH,MAAa,gBAAgB;IAU3B,YAAY,OAA2B,EAAE,KAA4B;QATpD;;;;;WAA6B;QACtC;;;;;WAA4B;QAC5B;;;;mBAAc,CAAC;WAAC;QAChB;;;;mBAAmB,IAAI,eAAe,EAAE;WAAC;QACzC;;;;;WAAyC;QACzC;;;;;WAA2C;QACnD,6EAA6E;QACrE;;;;;WAA8C;QAGpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,2CAA2C;IAC3C,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,oFAAoF;IACpF,cAAc;QACZ,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,EAAE,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAwB;QAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,gBAAgB;QACd,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;QAC/B,IAAI,SAAS,CAAC,iBAAiB;YAAE,SAAS,CAAC,iBAAiB,EAAE,CAAC;;YAC1D,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,uBAAuB,CAAC,SAAkB;QACxC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,gBAAgB;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YAAE,OAAO;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;QAClD,IAAI,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC;YAAE,OAAO;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;gBAAE,OAAO;YACnC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAA,iBAAS,GAAE,CAAC,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,6DAA6D;IAC7D,KAAK;QACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAEO,gBAAgB;QACtB,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;IACH,CAAC;IAEO,IAAI,CAAC,IAAwB;QACnC,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAClE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAC5C,CAAC,WAAW,CAAC;QAEd,IAAI,CAAC,6BAA6B,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CACtE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAC9C,CAAC,WAAW,CAAC;IAChB,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,2BAA2B,GAAG,SAAS,CAAC;QAC7C,IAAI,CAAC,6BAA6B,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,6BAA6B,GAAG,SAAS,CAAC;IACjD,CAAC;CACF;AA9HD,4CA8HC;AAED,SAAS,OAAO,CAAC,SAA6B;IAC5C,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,SAAS,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;IACtB,CAAC;AACH,CAAC","sourcesContent":["import { milliTime } from \"../../utils\";\nimport type {\n BandwidthEstimator,\n ProbeClusterConfig,\n} from \"./bandwidthEstimator\";\n\n/** What the binding reports back to its {@link RTCRtpSender}. */\nexport type EstimatorBindingHooks = {\n /** The active estimator changed its recommended bitrate (bps). */\n onAvailableBitrate: (bps: number) => void;\n /** The active estimator activated a probe cluster. */\n onProbeClusterConfig: (cfg: ProbeClusterConfig) => void;\n /** After each process tick (pin GetPacingRates padding_rate). */\n onProcessTick: () => void;\n /** The sender is stopped: the process timer neither starts nor ticks. */\n isStopped: () => boolean;\n};\n\n/**\n * The send-side bandwidth estimator of one {@link RTCRtpSender} and\n * everything tied to its lifetime: the event bridges to the sender, the\n * process timer, and the **generation**.\n *\n * The generation is bumped whenever the estimator is replaced, reset for a\n * new transport, or the sender stops. A send or padding drain captures it at\n * start and drops its estimator delivery when it no longer matches, so a\n * packet planned under the old estimator cannot pollute the new clean one or\n * revive a disposed probe controller. {@link generationSignal} aborts at the\n * same moment to release waits running at the old estimator's rate.\n */\nexport class EstimatorBinding {\n private readonly hooks: EstimatorBindingHooks;\n private current: BandwidthEstimator;\n private _generation = 0;\n private generationCancel = new AbortController();\n private unsubscribeAvailableBitrate?: () => void;\n private unsubscribeProbeClusterConfig?: () => void;\n /** Interval from {@link BandwidthEstimator.processIntervalMs} (0 = none). */\n private processTimer?: ReturnType<typeof setInterval>;\n\n constructor(initial: BandwidthEstimator, hooks: EstimatorBindingHooks) {\n this.hooks = hooks;\n this.current = initial;\n this.bind(initial);\n }\n\n get estimator(): BandwidthEstimator {\n return this.current;\n }\n\n get generation() {\n return this._generation;\n }\n\n /** Aborted on the next generation bump. */\n get generationSignal(): AbortSignal {\n return this.generationCancel.signal;\n }\n\n /** Invalidate sends planned under the current estimator and release their waits. */\n bumpGeneration() {\n this._generation++;\n this.generationCancel.abort();\n this.generationCancel = new AbortController();\n }\n\n /**\n * Make `impl` the active estimator with a clean state: bump the\n * generation, release the previous instance (`dispose()`, else `reset()`)\n * and always `reset()` `impl`, so a previously used instance does not merge\n * old state. The same instance is only reset.\n */\n replace(impl: BandwidthEstimator) {\n this.bumpGeneration();\n if (impl === this.current) {\n impl.reset?.();\n return;\n }\n this.unbind();\n release(this.current);\n impl.reset?.();\n this.current = impl;\n this.bind(impl);\n }\n\n /**\n * A new DTLS transport has its own transport-wide sequence space and path\n * (pin `OnNetworkRouteChanged` resets the controller): drop the path state\n * and keep app-configured constraints\n * ({@link BandwidthEstimator.resetNetworkRoute}, else `reset()`).\n */\n resetForNewRoute() {\n this.bumpGeneration();\n const estimator = this.current;\n if (estimator.resetNetworkRoute) estimator.resetNetworkRoute();\n else estimator.reset?.();\n }\n\n /**\n * pin `OnNetworkAvailability` — initial probes wait until DTLS can send.\n * Lightweight / disabled no-op `setNetworkAvailable`.\n */\n syncNetworkAvailability(connected: boolean) {\n this.current.setNetworkAvailable(connected);\n }\n\n /**\n * (Re)start the process timer for the active estimator (pin\n * `GoogCcNetworkControllerFactory::GetProcessInterval`).\n */\n syncProcessTimer() {\n this.stopProcessTimer();\n if (this.hooks.isStopped()) return;\n const intervalMs = this.current.processIntervalMs;\n if (!(intervalMs > 0)) return;\n const timer = setInterval(() => {\n if (this.hooks.isStopped()) return;\n this.current.process(milliTime());\n this.hooks.onProcessTick();\n }, intervalMs);\n timer.unref?.();\n this.processTimer = timer;\n }\n\n /** Sender stop: no timer, no bridges, estimator released. */\n close() {\n this.stopProcessTimer();\n this.unbind();\n release(this.current);\n }\n\n private stopProcessTimer() {\n if (this.processTimer !== undefined) {\n clearInterval(this.processTimer);\n this.processTimer = undefined;\n }\n }\n\n private bind(impl: BandwidthEstimator) {\n this.unsubscribeAvailableBitrate?.();\n this.unsubscribeAvailableBitrate = impl.onAvailableBitrate.subscribe(\n (bps) => this.hooks.onAvailableBitrate(bps),\n ).unSubscribe;\n\n this.unsubscribeProbeClusterConfig?.();\n this.unsubscribeProbeClusterConfig = impl.onProbeClusterConfig.subscribe(\n (cfg) => this.hooks.onProbeClusterConfig(cfg),\n ).unSubscribe;\n }\n\n private unbind() {\n this.unsubscribeAvailableBitrate?.();\n this.unsubscribeAvailableBitrate = undefined;\n this.unsubscribeProbeClusterConfig?.();\n this.unsubscribeProbeClusterConfig = undefined;\n }\n}\n\nfunction release(estimator: BandwidthEstimator) {\n if (estimator.dispose) {\n estimator.dispose();\n } else {\n estimator.reset?.();\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { Event } from "../../../imports/common";
2
+ import type { TransportWideCC } from "../../../imports/rtp";
3
+ import type { BandwidthEstimator, SentInfo } from "../bandwidthEstimator";
4
+ import { BandwidthEstimatorNoopHooks } from "../bandwidthEstimator";
5
+ /**
6
+ * Send-side BWE that ignores TWCC and never recommends a bitrate.
7
+ *
8
+ * Used when {@link PeerConfig.bandwidthEstimator} is `false` / `"none"`.
9
+ * Probe, pacing, RTT, and process-interval hooks are no-ops.
10
+ */
11
+ export declare class DisabledBandwidthEstimator extends BandwidthEstimatorNoopHooks implements BandwidthEstimator {
12
+ readonly onAvailableBitrate: Event<[number]>;
13
+ get availableBitrate(): number;
14
+ rtpPacketSent(_info: SentInfo): void;
15
+ receiveTWCC(_feedback: TransportWideCC): void;
16
+ reset(): void;
17
+ dispose(): void;
18
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisabledBandwidthEstimator = void 0;
4
+ const common_1 = require("../../../imports/common");
5
+ const bandwidthEstimator_1 = require("../bandwidthEstimator");
6
+ /**
7
+ * Send-side BWE that ignores TWCC and never recommends a bitrate.
8
+ *
9
+ * Used when {@link PeerConfig.bandwidthEstimator} is `false` / `"none"`.
10
+ * Probe, pacing, RTT, and process-interval hooks are no-ops.
11
+ */
12
+ class DisabledBandwidthEstimator extends bandwidthEstimator_1.BandwidthEstimatorNoopHooks {
13
+ constructor() {
14
+ super(...arguments);
15
+ /** @internal */
16
+ Object.defineProperty(this, "_availableBitrate", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: 0
21
+ });
22
+ Object.defineProperty(this, "onAvailableBitrate", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: new common_1.Event()
27
+ });
28
+ }
29
+ get availableBitrate() {
30
+ return 0;
31
+ }
32
+ rtpPacketSent(_info) { }
33
+ receiveTWCC(_feedback) { }
34
+ reset() {
35
+ this._availableBitrate = 0;
36
+ }
37
+ dispose() {
38
+ this.onAvailableBitrate.allUnsubscribe();
39
+ this.disposeNoopHooks();
40
+ this.reset();
41
+ }
42
+ }
43
+ exports.DisabledBandwidthEstimator = DisabledBandwidthEstimator;
44
+ //# sourceMappingURL=disabledBwe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disabledBwe.js","sourceRoot":"","sources":["../../../../../../src/media/sender/estimators/disabledBwe.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAGhD,8DAAoE;AAEpE;;;;;GAKG;AACH,MAAa,0BACX,SAAQ,gDAA2B;IADrC;;QAIE,gBAAgB;QAChB;;;;mBAAoB,CAAC;WAAC;QAEb;;;;mBAAqB,IAAI,cAAK,EAAY;WAAC;IAmBtD,CAAC;IAjBC,IAAI,gBAAgB;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,aAAa,CAAC,KAAe,IAAS,CAAC;IAEvC,WAAW,CAAC,SAA0B,IAAS,CAAC;IAEhD,KAAK;QACH,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC;QACzC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AA1BD,gEA0BC","sourcesContent":["import { Event } from \"../../../imports/common\";\nimport type { TransportWideCC } from \"../../../imports/rtp\";\nimport type { BandwidthEstimator, SentInfo } from \"../bandwidthEstimator\";\nimport { BandwidthEstimatorNoopHooks } from \"../bandwidthEstimator\";\n\n/**\n * Send-side BWE that ignores TWCC and never recommends a bitrate.\n *\n * Used when {@link PeerConfig.bandwidthEstimator} is `false` / `\"none\"`.\n * Probe, pacing, RTT, and process-interval hooks are no-ops.\n */\nexport class DisabledBandwidthEstimator\n extends BandwidthEstimatorNoopHooks\n implements BandwidthEstimator\n{\n /** @internal */\n _availableBitrate = 0;\n\n readonly onAvailableBitrate = new Event<[number]>();\n\n get availableBitrate() {\n return 0;\n }\n\n rtpPacketSent(_info: SentInfo): void {}\n\n receiveTWCC(_feedback: TransportWideCC): void {}\n\n reset(): void {\n this._availableBitrate = 0;\n }\n\n dispose(): void {\n this.onAvailableBitrate.allUnsubscribe();\n this.disposeNoopHooks();\n this.reset();\n }\n}\n"]}
@@ -0,0 +1,79 @@
1
+ /*!
2
+ * Portions of this file are ported from libwebrtc
3
+ * (https://webrtc.googlesource.com/src, commit 0fda16159e33adf59c71a7ad1173dcbe5a632102).
4
+ * Copyright (c) 2011, The WebRTC project authors. All rights reserved.
5
+ * Use of that source is governed by a BSD-style license and an additional
6
+ * patent grant; both are reproduced in THIRD_PARTY_LICENSES_LIBWEBRTC.txt
7
+ * (shipped with this package).
8
+ */
9
+ /**
10
+ * libwebrtc-aligned acknowledged throughput estimator.
11
+ *
12
+ * Default path matches pin `0fda1615…` where
13
+ * `RobustThroughputEstimatorSettings.enabled = true`
14
+ * (`modules/congestion_controller/goog_cc/robust_throughput_estimator.*`).
15
+ *
16
+ * Bayesian {@link BitrateEstimator} remains available for tests / field-trial
17
+ * parity when robust mode is disabled.
18
+ */
19
+ /** One ACKed packet sample (TWCC receive timeline + sender send time). */
20
+ export interface AckedPacketSample {
21
+ /** TWCC-relative receive time (ms). */
22
+ receiveTimeMs: number;
23
+ /** Sender send time (ms), same clock as SentInfo.sendingAtMs. */
24
+ sendTimeMs: number;
25
+ /** Packet size in bytes (payload + headers counted by BWE). */
26
+ sizeBytes: number;
27
+ /**
28
+ * pin `SentPacket.prior_unacked_data` — added to both send and receive
29
+ * size (RobustThroughputEstimator).
30
+ */
31
+ priorUnackedBytes?: number;
32
+ }
33
+ /**
34
+ * Sliding-window robust throughput (libwebrtc RobustThroughputEstimator).
35
+ *
36
+ * - Window: ≥ {@link kRobustWindowPackets} and ≥ {@link kRobustMinWindowDurationMs},
37
+ * capped by max packets / max duration
38
+ * - Replaces the largest receive gap with the second-largest (delay-spike guard)
39
+ * - Returns min(send_rate, recv_rate); send side drops reordered-old packets
40
+ */
41
+ export declare class AcknowledgedBitrateEstimator {
42
+ private window;
43
+ private latestDiscardedSendTimeMs;
44
+ reset(): void;
45
+ /**
46
+ * pin RobustThroughputEstimator::SetAlr — no-op on the robust path.
47
+ * Kept so GCC can publish ALR without branching on estimator type.
48
+ */
49
+ setAlr(_inAlr: boolean): void;
50
+ /** pin RobustThroughputEstimator::SetAlrEndedTime — no-op. */
51
+ setAlrEndedTime(_atTimeMs: number): void;
52
+ /**
53
+ * Ingest ACKed packets. Prefer **receive-time order** (libwebrtc
54
+ * `SortedByReceiveTime`); out-of-order samples are insertion-sorted.
55
+ */
56
+ incomingPacketFeedbackVector(packets: AckedPacketSample[]): void;
57
+ /** @returns estimated acked bitrate in bps, or 0 if not ready. */
58
+ bitrate(): number;
59
+ private firstPacketOutsideWindow;
60
+ }
61
+ /**
62
+ * Bayesian bitrate estimator (libwebrtc BitrateEstimator).
63
+ * Used when robust throughput is disabled; kept for parity / unit tests.
64
+ */
65
+ export declare class BitrateEstimator {
66
+ private sum;
67
+ private currentWindowMs;
68
+ private prevTimeMs;
69
+ private bitrateEstimateKbps;
70
+ private bitrateEstimateVar;
71
+ private readonly initialWindowMs;
72
+ private readonly nonInitialWindowMs;
73
+ private readonly uncertaintyScale;
74
+ reset(): void;
75
+ update(atTimeMs: number, bytes: number): void;
76
+ bitrate(): number;
77
+ expectFastRateChange(): void;
78
+ private updateWindow;
79
+ }