werift 0.26.0 → 0.28.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 (552) hide show
  1. package/README.md +182 -8
  2. package/THIRD_PARTY_LICENSES_LIBWEBRTC.txt +58 -0
  3. package/lib/common/src/binary.d.ts +1 -3
  4. package/lib/common/src/binary.js +8 -6
  5. package/lib/common/src/binary.js.map +1 -1
  6. package/lib/common/src/binaryData.js +2 -1
  7. package/lib/common/src/binaryData.js.map +1 -1
  8. package/lib/common/src/event.d.ts +26 -0
  9. package/lib/common/src/event.js +87 -2
  10. package/lib/common/src/event.js.map +1 -1
  11. package/lib/common/src/log.js +5 -7
  12. package/lib/common/src/log.js.map +1 -1
  13. package/lib/common/src/network.d.ts +6 -1
  14. package/lib/common/src/network.js +8 -2
  15. package/lib/common/src/network.js.map +1 -1
  16. package/lib/common/src/transport.d.ts +12 -5
  17. package/lib/common/src/transport.js +13 -7
  18. package/lib/common/src/transport.js.map +1 -1
  19. package/lib/dtls/src/alert.d.ts +49 -0
  20. package/lib/dtls/src/alert.js +103 -0
  21. package/lib/dtls/src/alert.js.map +1 -0
  22. package/lib/dtls/src/client.js +15 -1
  23. package/lib/dtls/src/client.js.map +1 -1
  24. package/lib/dtls/src/context/cipher.d.ts +1 -1
  25. package/lib/dtls/src/context/cipher.js +6 -3
  26. package/lib/dtls/src/context/cipher.js.map +1 -1
  27. package/lib/dtls/src/context/dtls.d.ts +2 -0
  28. package/lib/dtls/src/context/dtls.js +11 -2
  29. package/lib/dtls/src/context/dtls.js.map +1 -1
  30. package/lib/dtls/src/context/transport.d.ts +17 -1
  31. package/lib/dtls/src/context/transport.js +40 -3
  32. package/lib/dtls/src/context/transport.js.map +1 -1
  33. package/lib/dtls/src/flight/client/flight1.js +2 -1
  34. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  35. package/lib/dtls/src/flight/client/flight5.js +8 -3
  36. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  37. package/lib/dtls/src/flight/flight.d.ts +6 -1
  38. package/lib/dtls/src/flight/flight.js +18 -5
  39. package/lib/dtls/src/flight/flight.js.map +1 -1
  40. package/lib/dtls/src/flight/server/flight4.js +4 -2
  41. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  42. package/lib/dtls/src/flight/server/flight6.js +6 -2
  43. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  44. package/lib/dtls/src/handshake/const.d.ts +17 -13
  45. package/lib/dtls/src/handshake/const.js +16 -14
  46. package/lib/dtls/src/handshake/const.js.map +1 -1
  47. package/lib/dtls/src/handshake/message/alert.js +4 -2
  48. package/lib/dtls/src/handshake/message/alert.js.map +1 -1
  49. package/lib/dtls/src/handshake/message/certificate.js +2 -1
  50. package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
  51. package/lib/dtls/src/handshake/message/changeCipherSpec.js +2 -1
  52. package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
  53. package/lib/dtls/src/handshake/message/client/certificateVerify.js +4 -2
  54. package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
  55. package/lib/dtls/src/handshake/message/client/hello.js +14 -7
  56. package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
  57. package/lib/dtls/src/handshake/message/client/keyExchange.js +2 -1
  58. package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
  59. package/lib/dtls/src/handshake/message/finished.js +2 -1
  60. package/lib/dtls/src/handshake/message/finished.js.map +1 -1
  61. package/lib/dtls/src/handshake/message/server/certificateRequest.js +6 -3
  62. package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
  63. package/lib/dtls/src/handshake/message/server/hello.js +12 -6
  64. package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
  65. package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
  66. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +4 -2
  67. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
  68. package/lib/dtls/src/handshake/message/server/keyExchange.js +16 -8
  69. package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
  70. package/lib/dtls/src/handshake/random.d.ts +2 -2
  71. package/lib/dtls/src/handshake/random.js +5 -2
  72. package/lib/dtls/src/handshake/random.js.map +1 -1
  73. package/lib/dtls/src/index.d.ts +3 -1
  74. package/lib/dtls/src/index.js +10 -1
  75. package/lib/dtls/src/index.js.map +1 -1
  76. package/lib/dtls/src/record/const.d.ts +52 -33
  77. package/lib/dtls/src/record/const.js +51 -36
  78. package/lib/dtls/src/record/const.js.map +1 -1
  79. package/lib/dtls/src/record/message/fragment.js +12 -6
  80. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  81. package/lib/dtls/src/record/message/header.js +10 -5
  82. package/lib/dtls/src/record/message/header.js.map +1 -1
  83. package/lib/dtls/src/record/message/plaintext.js +4 -2
  84. package/lib/dtls/src/record/message/plaintext.js.map +1 -1
  85. package/lib/dtls/src/record/receive.d.ts +6 -0
  86. package/lib/dtls/src/record/receive.js +50 -19
  87. package/lib/dtls/src/record/receive.js.map +1 -1
  88. package/lib/dtls/src/server.js +19 -1
  89. package/lib/dtls/src/server.js.map +1 -1
  90. package/lib/dtls/src/socket.d.ts +134 -2
  91. package/lib/dtls/src/socket.js +326 -8
  92. package/lib/dtls/src/socket.js.map +1 -1
  93. package/lib/ice/src/candidate.d.ts +1 -1
  94. package/lib/ice/src/candidate.js +24 -12
  95. package/lib/ice/src/candidate.js.map +1 -1
  96. package/lib/ice/src/candidateError.d.ts +155 -0
  97. package/lib/ice/src/candidateError.js +246 -0
  98. package/lib/ice/src/candidateError.js.map +1 -0
  99. package/lib/ice/src/candidateGatherer.d.ts +127 -0
  100. package/lib/ice/src/candidateGatherer.js +745 -0
  101. package/lib/ice/src/candidateGatherer.js.map +1 -0
  102. package/lib/ice/src/consent.d.ts +49 -0
  103. package/lib/ice/src/consent.js +258 -0
  104. package/lib/ice/src/consent.js.map +1 -0
  105. package/lib/ice/src/dns/lookup.d.ts +10 -1
  106. package/lib/ice/src/dns/lookup.js +42 -7
  107. package/lib/ice/src/dns/lookup.js.map +1 -1
  108. package/lib/ice/src/exceptions.d.ts +21 -5
  109. package/lib/ice/src/exceptions.js +58 -13
  110. package/lib/ice/src/exceptions.js.map +1 -1
  111. package/lib/ice/src/ice.d.ts +254 -58
  112. package/lib/ice/src/ice.js +979 -945
  113. package/lib/ice/src/ice.js.map +1 -1
  114. package/lib/ice/src/iceBase.d.ts +328 -14
  115. package/lib/ice/src/iceBase.js +254 -38
  116. package/lib/ice/src/iceBase.js.map +1 -1
  117. package/lib/ice/src/index.d.ts +1 -0
  118. package/lib/ice/src/index.js +1 -0
  119. package/lib/ice/src/index.js.map +1 -1
  120. package/lib/ice/src/internal/checkMessages.d.ts +41 -0
  121. package/lib/ice/src/internal/checkMessages.js +63 -0
  122. package/lib/ice/src/internal/checkMessages.js.map +1 -0
  123. package/lib/ice/src/internal/defaultRoute.d.ts +20 -0
  124. package/lib/ice/src/internal/defaultRoute.js +134 -0
  125. package/lib/ice/src/internal/defaultRoute.js.map +1 -0
  126. package/lib/ice/src/internal/hostInterfaces.d.ts +17 -0
  127. package/lib/ice/src/internal/hostInterfaces.js +77 -0
  128. package/lib/ice/src/internal/hostInterfaces.js.map +1 -0
  129. package/lib/ice/src/internal/hostPreference.d.ts +24 -0
  130. package/lib/ice/src/internal/hostPreference.js +38 -0
  131. package/lib/ice/src/internal/hostPreference.js.map +1 -0
  132. package/lib/ice/src/internal/resolveHostAddresses.d.ts +56 -8
  133. package/lib/ice/src/internal/resolveHostAddresses.js +127 -24
  134. package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -1
  135. package/lib/ice/src/internal/selectAddresses.d.ts +27 -0
  136. package/lib/ice/src/internal/selectAddresses.js +37 -18
  137. package/lib/ice/src/internal/selectAddresses.js.map +1 -1
  138. package/lib/ice/src/nomination/regularNomination.d.ts +200 -0
  139. package/lib/ice/src/nomination/regularNomination.js +311 -0
  140. package/lib/ice/src/nomination/regularNomination.js.map +1 -0
  141. package/lib/ice/src/nomination/selectionReplacement.d.ts +138 -0
  142. package/lib/ice/src/nomination/selectionReplacement.js +371 -0
  143. package/lib/ice/src/nomination/selectionReplacement.js.map +1 -0
  144. package/lib/ice/src/provisional.d.ts +139 -0
  145. package/lib/ice/src/provisional.js +468 -0
  146. package/lib/ice/src/provisional.js.map +1 -0
  147. package/lib/ice/src/stun/protocol.d.ts +9 -2
  148. package/lib/ice/src/stun/protocol.js +16 -17
  149. package/lib/ice/src/stun/protocol.js.map +1 -1
  150. package/lib/ice/src/stun/tcpProtocol.d.ts +1 -1
  151. package/lib/ice/src/stun/tcpProtocol.js +7 -7
  152. package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
  153. package/lib/ice/src/stun/transaction.d.ts +30 -1
  154. package/lib/ice/src/stun/transaction.js +90 -19
  155. package/lib/ice/src/stun/transaction.js.map +1 -1
  156. package/lib/ice/src/turn/credential.d.ts +49 -0
  157. package/lib/ice/src/turn/credential.js +78 -0
  158. package/lib/ice/src/turn/credential.js.map +1 -0
  159. package/lib/ice/src/turn/protocol.d.ts +31 -10
  160. package/lib/ice/src/turn/protocol.js +127 -51
  161. package/lib/ice/src/turn/protocol.js.map +1 -1
  162. package/lib/ice/src/types/model.d.ts +16 -5
  163. package/lib/ice/src/types/model.js.map +1 -1
  164. package/lib/ice-server/src/stun/attributes.d.ts +2 -0
  165. package/lib/ice-server/src/stun/attributes.js +11 -1
  166. package/lib/ice-server/src/stun/attributes.js.map +1 -1
  167. package/lib/ice-server/src/stun/const.d.ts +44 -17
  168. package/lib/ice-server/src/stun/const.js +31 -19
  169. package/lib/ice-server/src/stun/const.js.map +1 -1
  170. package/lib/ice-server/src/stun/message.d.ts +29 -4
  171. package/lib/ice-server/src/stun/message.js +115 -24
  172. package/lib/ice-server/src/stun/message.js.map +1 -1
  173. package/lib/index.mjs +35121 -22337
  174. package/lib/nonstandard/index.mjs +3169 -1399
  175. package/lib/polyfill/dom.mjs +24650 -12365
  176. package/lib/polyfill/index.mjs +24650 -12365
  177. package/lib/rtp/src/codec/assertPayload.d.ts +4 -0
  178. package/lib/rtp/src/codec/assertPayload.js +12 -0
  179. package/lib/rtp/src/codec/assertPayload.js.map +1 -0
  180. package/lib/rtp/src/codec/av1.js +2 -0
  181. package/lib/rtp/src/codec/av1.js.map +1 -1
  182. package/lib/rtp/src/codec/h264.js +35 -43
  183. package/lib/rtp/src/codec/h264.js.map +1 -1
  184. package/lib/rtp/src/codec/vp8.js +11 -5
  185. package/lib/rtp/src/codec/vp8.js.map +1 -1
  186. package/lib/rtp/src/codec/vp9.js +12 -0
  187. package/lib/rtp/src/codec/vp9.js.map +1 -1
  188. package/lib/rtp/src/extra/container/mp4/container.js +2 -1
  189. package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
  190. package/lib/rtp/src/extra/container/mp4/exp-golomb.js +2 -1
  191. package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
  192. package/lib/rtp/src/extra/container/mp4/h264.d.ts +21 -17
  193. package/lib/rtp/src/extra/container/mp4/h264.js +26 -24
  194. package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
  195. package/lib/rtp/src/extra/container/ogg/index.d.ts +1 -0
  196. package/lib/rtp/src/extra/container/ogg/index.js +1 -0
  197. package/lib/rtp/src/extra/container/ogg/index.js.map +1 -1
  198. package/lib/rtp/src/extra/container/ogg/writer.d.ts +90 -0
  199. package/lib/rtp/src/extra/container/ogg/writer.js +300 -0
  200. package/lib/rtp/src/extra/container/ogg/writer.js.map +1 -0
  201. package/lib/rtp/src/extra/container/webm/ebml/ebml.js +6 -3
  202. package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
  203. package/lib/rtp/src/extra/processor/depacketizer.d.ts +5 -0
  204. package/lib/rtp/src/extra/processor/depacketizer.js +28 -2
  205. package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
  206. package/lib/rtp/src/extra/processor/dtx.js +4 -2
  207. package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
  208. package/lib/rtp/src/extra/processor/index.d.ts +2 -0
  209. package/lib/rtp/src/extra/processor/index.js +2 -0
  210. package/lib/rtp/src/extra/processor/index.js.map +1 -1
  211. package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +29 -6
  212. package/lib/rtp/src/extra/processor/jitterBuffer.js +101 -111
  213. package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
  214. package/lib/rtp/src/extra/processor/jitterBufferTransformer.js +2 -1
  215. package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
  216. package/lib/rtp/src/extra/processor/lipsync.d.ts +63 -0
  217. package/lib/rtp/src/extra/processor/lipsync.js +202 -51
  218. package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
  219. package/lib/rtp/src/extra/processor/mp4.d.ts +0 -6
  220. package/lib/rtp/src/extra/processor/mp4.js +6 -3
  221. package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
  222. package/lib/rtp/src/extra/processor/mute.js +4 -2
  223. package/lib/rtp/src/extra/processor/mute.js.map +1 -1
  224. package/lib/rtp/src/extra/processor/nack.js +4 -2
  225. package/lib/rtp/src/extra/processor/nack.js.map +1 -1
  226. package/lib/rtp/src/extra/processor/ntpTime.js +4 -6
  227. package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
  228. package/lib/rtp/src/extra/processor/ogg.d.ts +72 -0
  229. package/lib/rtp/src/extra/processor/ogg.js +221 -0
  230. package/lib/rtp/src/extra/processor/ogg.js.map +1 -0
  231. package/lib/rtp/src/extra/processor/oggCallback.d.ts +21 -0
  232. package/lib/rtp/src/extra/processor/oggCallback.js +97 -0
  233. package/lib/rtp/src/extra/processor/oggCallback.js.map +1 -0
  234. package/lib/rtp/src/extra/processor/rtpCallback.js +2 -1
  235. package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
  236. package/lib/rtp/src/extra/processor/rtpStream.js +2 -1
  237. package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
  238. package/lib/rtp/src/extra/processor/rtpTime.js +2 -1
  239. package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
  240. package/lib/rtp/src/extra/processor/webm.js +14 -7
  241. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  242. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  243. package/lib/rtp/src/index.d.ts +8 -0
  244. package/lib/rtp/src/index.js +8 -0
  245. package/lib/rtp/src/index.js.map +1 -1
  246. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +4 -0
  247. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +4 -0
  248. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
  249. package/lib/rtp/src/rtcp/rtcp.js +8 -4
  250. package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
  251. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.d.ts +58 -0
  252. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js +143 -0
  253. package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js.map +1 -0
  254. package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +35 -13
  255. package/lib/rtp/src/rtcp/rtpfb/twcc.js +132 -54
  256. package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
  257. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.d.ts +13 -0
  258. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js +29 -0
  259. package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js.map +1 -0
  260. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.d.ts +41 -0
  261. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js +89 -0
  262. package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js.map +1 -0
  263. package/lib/rtp/src/rtcp/sr.js +1 -0
  264. package/lib/rtp/src/rtcp/sr.js.map +1 -1
  265. package/lib/rtp/src/rtp/continuity.d.ts +49 -0
  266. package/lib/rtp/src/rtp/continuity.js +120 -0
  267. package/lib/rtp/src/rtp/continuity.js.map +1 -0
  268. package/lib/rtp/src/rtp/headerExtension.js +41 -21
  269. package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
  270. package/lib/rtp/src/rtp/padding.d.ts +17 -0
  271. package/lib/rtp/src/rtp/padding.js +37 -0
  272. package/lib/rtp/src/rtp/padding.js.map +1 -0
  273. package/lib/rtp/src/rtp/red/encoder.d.ts +10 -0
  274. package/lib/rtp/src/rtp/red/encoder.js +14 -1
  275. package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
  276. package/lib/rtp/src/rtp/red/packet.js +24 -8
  277. package/lib/rtp/src/rtp/red/packet.js.map +1 -1
  278. package/lib/rtp/src/rtp/rtp.d.ts +24 -1
  279. package/lib/rtp/src/rtp/rtp.js +70 -29
  280. package/lib/rtp/src/rtp/rtp.js.map +1 -1
  281. package/lib/rtp/src/rtp/rtx.js +3 -0
  282. package/lib/rtp/src/rtp/rtx.js.map +1 -1
  283. package/lib/rtp/src/rtp/sendHeaderExtensions.d.ts +36 -0
  284. package/lib/rtp/src/rtp/sendHeaderExtensions.js +85 -0
  285. package/lib/rtp/src/rtp/sendHeaderExtensions.js.map +1 -0
  286. package/lib/rtp/src/rtp/timelineRewriter.d.ts +178 -0
  287. package/lib/rtp/src/rtp/timelineRewriter.js +417 -0
  288. package/lib/rtp/src/rtp/timelineRewriter.js.map +1 -0
  289. package/lib/rtp/src/srtp/cipher/ctr.js +4 -2
  290. package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
  291. package/lib/rtp/src/srtp/cipher/index.js +8 -4
  292. package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
  293. package/lib/rtp/src/srtp/context/context.js +6 -3
  294. package/lib/rtp/src/srtp/context/context.js.map +1 -1
  295. package/lib/rtp/src/srtp/context/srtcp.d.ts +1 -1
  296. package/lib/rtp/src/srtp/context/srtcp.js +33 -0
  297. package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
  298. package/lib/rtp/src/srtp/context/srtp.d.ts +1 -1
  299. package/lib/rtp/src/srtp/context/srtp.js +34 -10
  300. package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
  301. package/lib/rtp/src/srtp/error.d.ts +8 -0
  302. package/lib/rtp/src/srtp/error.js +13 -1
  303. package/lib/rtp/src/srtp/error.js.map +1 -1
  304. package/lib/rtp/src/srtp/packet.js +4 -1
  305. package/lib/rtp/src/srtp/packet.js.map +1 -1
  306. package/lib/rtp/src/srtp/replay.d.ts +24 -0
  307. package/lib/rtp/src/srtp/replay.js +75 -0
  308. package/lib/rtp/src/srtp/replay.js.map +1 -0
  309. package/lib/rtp/src/srtp/session.js +2 -1
  310. package/lib/rtp/src/srtp/session.js.map +1 -1
  311. package/lib/rtp/src/srtp/srtcp.js +2 -1
  312. package/lib/rtp/src/srtp/srtcp.js.map +1 -1
  313. package/lib/rtp/src/srtp/srtp.js +2 -1
  314. package/lib/rtp/src/srtp/srtp.js.map +1 -1
  315. package/lib/rtp/src/util.js +2 -1
  316. package/lib/rtp/src/util.js.map +1 -1
  317. package/lib/sctp/src/chunk.d.ts +5 -0
  318. package/lib/sctp/src/chunk.js +31 -8
  319. package/lib/sctp/src/chunk.js.map +1 -1
  320. package/lib/sctp/src/const.d.ts +25 -17
  321. package/lib/sctp/src/const.js +23 -19
  322. package/lib/sctp/src/const.js.map +1 -1
  323. package/lib/sctp/src/param.d.ts +6 -2
  324. package/lib/sctp/src/param.js +22 -8
  325. package/lib/sctp/src/param.js.map +1 -1
  326. package/lib/sctp/src/sctp.d.ts +85 -0
  327. package/lib/sctp/src/sctp.js +707 -126
  328. package/lib/sctp/src/sctp.js.map +1 -1
  329. package/lib/sctp/src/transport.js +4 -2
  330. package/lib/sctp/src/transport.js.map +1 -1
  331. package/lib/webrtc/src/api/compatibilityOptions.d.ts +33 -0
  332. package/lib/webrtc/src/api/compatibilityOptions.js +33 -0
  333. package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -0
  334. package/lib/webrtc/src/api/peerConfig.d.ts +385 -28
  335. package/lib/webrtc/src/api/peerConfig.js +121 -14
  336. package/lib/webrtc/src/api/peerConfig.js.map +1 -1
  337. package/lib/webrtc/src/api/peerConnectionEvents.d.ts +77 -1
  338. package/lib/webrtc/src/api/peerConnectionEvents.js +105 -1
  339. package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
  340. package/lib/webrtc/src/dataChannel.d.ts +10 -0
  341. package/lib/webrtc/src/dataChannel.js +24 -4
  342. package/lib/webrtc/src/dataChannel.js.map +1 -1
  343. package/lib/webrtc/src/helper.d.ts +8 -0
  344. package/lib/webrtc/src/helper.js +40 -4
  345. package/lib/webrtc/src/helper.js.map +1 -1
  346. package/lib/webrtc/src/media/codecCompatibility.d.ts +87 -1
  347. package/lib/webrtc/src/media/codecCompatibility.js +338 -12
  348. package/lib/webrtc/src/media/codecCompatibility.js.map +1 -1
  349. package/lib/webrtc/src/media/index.d.ts +10 -0
  350. package/lib/webrtc/src/media/index.js +70 -0
  351. package/lib/webrtc/src/media/index.js.map +1 -1
  352. package/lib/webrtc/src/media/receiver/nack.d.ts +43 -10
  353. package/lib/webrtc/src/media/receiver/nack.js +246 -88
  354. package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
  355. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +61 -1
  356. package/lib/webrtc/src/media/receiver/receiverTwcc.js +218 -63
  357. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  358. package/lib/webrtc/src/media/router.d.ts +241 -40
  359. package/lib/webrtc/src/media/router.js +676 -205
  360. package/lib/webrtc/src/media/router.js.map +1 -1
  361. package/lib/webrtc/src/media/routing/pendingRoutes.d.ts +26 -0
  362. package/lib/webrtc/src/media/routing/pendingRoutes.js +48 -0
  363. package/lib/webrtc/src/media/routing/pendingRoutes.js.map +1 -0
  364. package/lib/webrtc/src/media/routing/ridRouting.d.ts +37 -0
  365. package/lib/webrtc/src/media/routing/ridRouting.js +74 -0
  366. package/lib/webrtc/src/media/routing/ridRouting.js.map +1 -0
  367. package/lib/webrtc/src/media/routing/routeTable.d.ts +60 -0
  368. package/lib/webrtc/src/media/routing/routeTable.js +95 -0
  369. package/lib/webrtc/src/media/routing/routeTable.js.map +1 -0
  370. package/lib/webrtc/src/media/routing/rtcpRouting.d.ts +34 -0
  371. package/lib/webrtc/src/media/routing/rtcpRouting.js +165 -0
  372. package/lib/webrtc/src/media/routing/rtcpRouting.js.map +1 -0
  373. package/lib/webrtc/src/media/routing/unknownSsrc.d.ts +55 -0
  374. package/lib/webrtc/src/media/routing/unknownSsrc.js +117 -0
  375. package/lib/webrtc/src/media/routing/unknownSsrc.js.map +1 -0
  376. package/lib/webrtc/src/media/rtpReceiver.d.ts +252 -2
  377. package/lib/webrtc/src/media/rtpReceiver.js +833 -44
  378. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  379. package/lib/webrtc/src/media/rtpSender.d.ts +191 -70
  380. package/lib/webrtc/src/media/rtpSender.js +631 -448
  381. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  382. package/lib/webrtc/src/media/rtpTransceiver.d.ts +19 -3
  383. package/lib/webrtc/src/media/rtpTransceiver.js +74 -9
  384. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  385. package/lib/webrtc/src/media/sender/bandwidthEstimator.d.ts +249 -0
  386. package/lib/webrtc/src/media/sender/bandwidthEstimator.js +144 -0
  387. package/lib/webrtc/src/media/sender/bandwidthEstimator.js.map +1 -0
  388. package/lib/webrtc/src/media/sender/createBandwidthEstimator.d.ts +20 -0
  389. package/lib/webrtc/src/media/sender/createBandwidthEstimator.js +26 -0
  390. package/lib/webrtc/src/media/sender/createBandwidthEstimator.js.map +1 -0
  391. package/lib/webrtc/src/media/sender/estimatorBinding.d.ts +70 -0
  392. package/lib/webrtc/src/media/sender/estimatorBinding.js +175 -0
  393. package/lib/webrtc/src/media/sender/estimatorBinding.js.map +1 -0
  394. package/lib/webrtc/src/media/sender/estimators/disabledBwe.d.ts +18 -0
  395. package/lib/webrtc/src/media/sender/estimators/disabledBwe.js +44 -0
  396. package/lib/webrtc/src/media/sender/estimators/disabledBwe.js.map +1 -0
  397. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.d.ts +79 -0
  398. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js +289 -0
  399. package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js.map +1 -0
  400. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.d.ts +87 -0
  401. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js +429 -0
  402. package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js.map +1 -0
  403. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.d.ts +21 -0
  404. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js +84 -0
  405. package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js.map +1 -0
  406. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.d.ts +37 -0
  407. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js +74 -0
  408. package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js.map +1 -0
  409. package/lib/webrtc/src/media/sender/estimators/gcc/constants.d.ts +383 -0
  410. package/lib/webrtc/src/media/sender/estimators/gcc/constants.js +408 -0
  411. package/lib/webrtc/src/media/sender/estimators/gcc/constants.js.map +1 -0
  412. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.d.ts +406 -0
  413. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js +1391 -0
  414. package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js.map +1 -0
  415. package/lib/webrtc/src/media/sender/estimators/gcc/index.d.ts +19 -0
  416. package/lib/webrtc/src/media/sender/estimators/gcc/index.js +75 -0
  417. package/lib/webrtc/src/media/sender/estimators/gcc/index.js.map +1 -0
  418. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.d.ts +68 -0
  419. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js +201 -0
  420. package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js.map +1 -0
  421. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.d.ts +26 -0
  422. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js +72 -0
  423. package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js.map +1 -0
  424. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.d.ts +41 -0
  425. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js +99 -0
  426. package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js.map +1 -0
  427. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.d.ts +247 -0
  428. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js +1042 -0
  429. package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js.map +1 -0
  430. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.d.ts +26 -0
  431. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js +132 -0
  432. package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js.map +1 -0
  433. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.d.ts +305 -0
  434. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js +1073 -0
  435. package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js.map +1 -0
  436. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.d.ts +60 -0
  437. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js +151 -0
  438. package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js.map +1 -0
  439. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.d.ts +44 -0
  440. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js +246 -0
  441. package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js.map +1 -0
  442. package/lib/webrtc/src/media/sender/estimators/index.d.ts +7 -0
  443. package/lib/webrtc/src/media/sender/estimators/index.js +19 -0
  444. package/lib/webrtc/src/media/sender/estimators/index.js.map +1 -0
  445. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.d.ts +64 -0
  446. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js +216 -0
  447. package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js.map +1 -0
  448. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.d.ts +117 -0
  449. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js +250 -0
  450. package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js.map +1 -0
  451. package/lib/webrtc/src/media/sender/outgoingQueue.d.ts +40 -0
  452. package/lib/webrtc/src/media/sender/outgoingQueue.js +153 -0
  453. package/lib/webrtc/src/media/sender/outgoingQueue.js.map +1 -0
  454. package/lib/webrtc/src/media/sender/padding.d.ts +45 -0
  455. package/lib/webrtc/src/media/sender/padding.js +134 -0
  456. package/lib/webrtc/src/media/sender/padding.js.map +1 -0
  457. package/lib/webrtc/src/media/sender/pendingRtp.d.ts +35 -0
  458. package/lib/webrtc/src/media/sender/pendingRtp.js +120 -0
  459. package/lib/webrtc/src/media/sender/pendingRtp.js.map +1 -0
  460. package/lib/webrtc/src/media/sender/rtpWire.d.ts +13 -0
  461. package/lib/webrtc/src/media/sender/rtpWire.js +38 -0
  462. package/lib/webrtc/src/media/sender/rtpWire.js.map +1 -0
  463. package/lib/webrtc/src/media/sender/sendPacer.d.ts +27 -0
  464. package/lib/webrtc/src/media/sender/sendPacer.js +110 -0
  465. package/lib/webrtc/src/media/sender/sendPacer.js.map +1 -0
  466. package/lib/webrtc/src/media/sender/senderBWE.d.ts +8 -33
  467. package/lib/webrtc/src/media/sender/senderBWE.js +5 -154
  468. package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
  469. package/lib/webrtc/src/media/sender/senderReportHistory.d.ts +51 -0
  470. package/lib/webrtc/src/media/sender/senderReportHistory.js +111 -0
  471. package/lib/webrtc/src/media/sender/senderReportHistory.js.map +1 -0
  472. package/lib/webrtc/src/media/sender/senderStats.d.ts +101 -0
  473. package/lib/webrtc/src/media/sender/senderStats.js +317 -0
  474. package/lib/webrtc/src/media/sender/senderStats.js.map +1 -0
  475. package/lib/webrtc/src/media/track.d.ts +29 -2
  476. package/lib/webrtc/src/media/track.js +32 -5
  477. package/lib/webrtc/src/media/track.js.map +1 -1
  478. package/lib/webrtc/src/negotiation/bundleTopology.d.ts +1 -5
  479. package/lib/webrtc/src/negotiation/bundleTopology.js +15 -11
  480. package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -1
  481. package/lib/webrtc/src/negotiation/descriptionValidation.js +12 -6
  482. package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -1
  483. package/lib/webrtc/src/negotiation/negotiationNeeded.js +2 -1
  484. package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -1
  485. package/lib/webrtc/src/negotiation/remoteCandidates.js +10 -5
  486. package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
  487. package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +24 -7
  488. package/lib/webrtc/src/negotiation/remoteMediaApplication.js +67 -27
  489. package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -1
  490. package/lib/webrtc/src/negotiation/transceiverPairing.d.ts +1 -0
  491. package/lib/webrtc/src/negotiation/transceiverPairing.js +62 -0
  492. package/lib/webrtc/src/negotiation/transceiverPairing.js.map +1 -0
  493. package/lib/webrtc/src/negotiation/transportActivation.d.ts +8 -1
  494. package/lib/webrtc/src/negotiation/transportActivation.js +40 -8
  495. package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
  496. package/lib/webrtc/src/negotiationTransaction.d.ts +43 -5
  497. package/lib/webrtc/src/negotiationTransaction.js +129 -13
  498. package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
  499. package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
  500. package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
  501. package/lib/webrtc/src/nonstandard/navigator.js +4 -3
  502. package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
  503. package/lib/webrtc/src/nonstandard/recorder/index.d.ts +32 -8
  504. package/lib/webrtc/src/nonstandard/recorder/index.js +81 -20
  505. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  506. package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +9 -7
  507. package/lib/webrtc/src/nonstandard/recorder/writer/index.js +2 -1
  508. package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
  509. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.d.ts +32 -0
  510. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js +185 -0
  511. package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js.map +1 -0
  512. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +8 -1
  513. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  514. package/lib/webrtc/src/nonstandard/userMedia.js +2 -1
  515. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  516. package/lib/webrtc/src/peerConnection.d.ts +108 -6
  517. package/lib/webrtc/src/peerConnection.js +357 -36
  518. package/lib/webrtc/src/peerConnection.js.map +1 -1
  519. package/lib/webrtc/src/polyfill/globals.d.ts +2 -1
  520. package/lib/webrtc/src/polyfill/globals.js.map +1 -1
  521. package/lib/webrtc/src/polyfill/install.js +2 -0
  522. package/lib/webrtc/src/polyfill/install.js.map +1 -1
  523. package/lib/webrtc/src/polyfill/mediaDevices.js +2 -1
  524. package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
  525. package/lib/webrtc/src/sctpManager.d.ts +46 -14
  526. package/lib/webrtc/src/sctpManager.js +92 -25
  527. package/lib/webrtc/src/sctpManager.js.map +1 -1
  528. package/lib/webrtc/src/sdp.d.ts +69 -0
  529. package/lib/webrtc/src/sdp.js +151 -20
  530. package/lib/webrtc/src/sdp.js.map +1 -1
  531. package/lib/webrtc/src/sdpManager.d.ts +85 -4
  532. package/lib/webrtc/src/sdpManager.js +214 -14
  533. package/lib/webrtc/src/sdpManager.js.map +1 -1
  534. package/lib/webrtc/src/secureTransportManager.d.ts +89 -4
  535. package/lib/webrtc/src/secureTransportManager.js +184 -26
  536. package/lib/webrtc/src/secureTransportManager.js.map +1 -1
  537. package/lib/webrtc/src/transceiverManager.d.ts +82 -4
  538. package/lib/webrtc/src/transceiverManager.js +239 -41
  539. package/lib/webrtc/src/transceiverManager.js.map +1 -1
  540. package/lib/webrtc/src/transport/dtls.d.ts +147 -1
  541. package/lib/webrtc/src/transport/dtls.js +446 -50
  542. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  543. package/lib/webrtc/src/transport/ice.d.ts +71 -90
  544. package/lib/webrtc/src/transport/ice.js +250 -42
  545. package/lib/webrtc/src/transport/ice.js.map +1 -1
  546. package/lib/webrtc/src/transport/sctp.d.ts +25 -0
  547. package/lib/webrtc/src/transport/sctp.js +153 -22
  548. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  549. package/lib/webrtc/src/utils.d.ts +69 -3
  550. package/lib/webrtc/src/utils.js +105 -16
  551. package/lib/webrtc/src/utils.js.map +1 -1
  552. package/package.json +9 -6
@@ -24,16 +24,18 @@ import { FullIntraRequest, GenericNack, RedEncoder, type RtcpPacket, type RtpHea
24
24
  import type { RTCDtlsTransport } from "../transport/dtls";
25
25
  import type { Kind } from "../types/domain";
26
26
  import type { RTCRtpCodecParameters, RTCRtpHeaderExtensionParameters, RTCRtpSendParameters } from "./parameters";
27
- import { SenderBandwidthEstimator } from "./sender/senderBWE";
27
+ import { type BandwidthEstimator, type CongestionEventsCompatibility, type ProbeClusterConfig } from "./sender/bandwidthEstimator";
28
+ import { type PendingRtpOptions } from "./sender/pendingRtp";
28
29
  import { type RTCStats, type RTCStatsReport } from "./stats";
29
30
  import { type MediaStream, type MediaStreamTrack } from "./track";
30
- export type PendingRtpOptions = {
31
- /** Queue RTP until DTLS is connected and a codec is set. Default true when this object is passed. */
32
- enabled?: boolean;
33
- /** Max queued packets when enabled. Oldest packets are dropped. Default 256. */
34
- maxLength?: number;
35
- };
31
+ export type { PendingRtpOptions } from "./sender/pendingRtp";
36
32
  export type RTCRtpSenderOptions = {
33
+ /**
34
+ * Initial send-side bandwidth estimator. When omitted, the default is
35
+ * {@link LightweightBandwidthEstimator}. {@link RTCPeerConnection} passes the
36
+ * instance created from {@link PeerConfig.bandwidthEstimator}.
37
+ */
38
+ bandwidthEstimator?: BandwidthEstimator;
37
39
  /** Pending RTP cache. Disabled by default. Pass `true` or `{ maxLength }` to enable. */
38
40
  pendingRtp?: boolean | PendingRtpOptions;
39
41
  };
@@ -48,6 +50,62 @@ export declare class RTCRtpSender {
48
50
  readonly onRtcp: Event<[RtcpPacket]>;
49
51
  readonly onPictureLossIndication: Event<[]>;
50
52
  readonly onGenericNack: Event<[GenericNack]>;
53
+ /**
54
+ * Active send-side bandwidth estimator (TWCC-driven) with its generation
55
+ * and process timer. Replaced only via {@link setBandwidthEstimator}.
56
+ */
57
+ private readonly bwe;
58
+ /**
59
+ * Active send-side bandwidth estimator (TWCC-driven).
60
+ *
61
+ * Default is {@link LightweightBandwidthEstimator} (lightweight cumulative algorithm).
62
+ * Replace only with {@link setBandwidthEstimator} (e.g. `new GccBandwidthEstimator()`).
63
+ *
64
+ * Prefer {@link onAvailableBitrate} on this sender for bitrate notifications that
65
+ * survive estimator swaps. Algorithm-specific events remain on concrete instances.
66
+ *
67
+ * **TypeScript compatibility:** {@link CongestionEventsCompatibility} fields
68
+ * (`onCongestion` / `onCongestionScore`) are present on every estimator so
69
+ * existing `sender.senderBWE.onCongestion.subscribe(...)` still type-checks.
70
+ * They fire only on {@link LightweightBandwidthEstimator}; GCC / disabled are no-ops.
71
+ * Prefer `sender.senderBWE as LightweightBandwidthEstimator` (or
72
+ * {@link isLightweightBandwidthEstimator}) for lightweight-only APIs.
73
+ */
74
+ get senderBWE(): BandwidthEstimator & CongestionEventsCompatibility;
75
+ /**
76
+ * Stable recommended send bitrate event (**bps**, change-only).
77
+ * Bridged from the active {@link BandwidthEstimator}; subscriptions survive
78
+ * {@link setBandwidthEstimator} without re-subscribing.
79
+ *
80
+ * Prefer this over `senderBWE.onAvailableBitrate` for application adaptation.
81
+ */
82
+ readonly onAvailableBitrate: Event<[number]>;
83
+ /**
84
+ * Probe cluster configs (target bps / min packets). Bridged from the active
85
+ * {@link BandwidthEstimator}; GCC fires this, lightweight / disabled never do.
86
+ */
87
+ readonly onProbeClusterConfig: Event<[ProbeClusterConfig]>;
88
+ /** Token-bucket pacer for **media** (not probe) rate enforcement. */
89
+ private readonly pacer;
90
+ /**
91
+ * pin `pending_untracked_size_` — bytes sent without TWCC tracking,
92
+ * attached to the next tracked packet as `priorUnackedBytes`.
93
+ */
94
+ private pendingUntrackedBytes;
95
+ /**
96
+ * GCC send FIFO: reservation → pacing wait → seq / TSN assignment → DTLS write.
97
+ * Probe padding may call {@link sendRtpInternal} on this stack only after
98
+ * the current packet's DTLS write ({@link nestOutgoingPadding}); timer /
99
+ * cluster events always enqueue so they cannot share a DTLS write.
100
+ */
101
+ private readonly outgoing;
102
+ /**
103
+ * Set only around post-DTLS {@link maybeInjectProbePadding} so padding can
104
+ * drain on the same FIFO task without deadlock. Must stay false during
105
+ * probe/pacing wait, or a cluster event would send in parallel.
106
+ */
107
+ private nestOutgoingPadding;
108
+ private readonly padding;
51
109
  /** Fires for a FIR addressed to this sender with a new sequence number (RFC 5104 4.3.1). */
52
110
  readonly onFullIntraRequest: Event<[FullIntraRequest]>;
53
111
  /**
@@ -55,7 +113,6 @@ export declare class RTCRtpSender {
55
113
  * that is not a retransmission. Fires in addition to onPictureLossIndication / onFullIntraRequest.
56
114
  */
57
115
  readonly onKeyFrameRequest: Event<["fir" | "pli"]>;
58
- readonly senderBWE: SenderBandwidthEstimator;
59
116
  private cname?;
60
117
  private mid?;
61
118
  private rtpStreamId?;
@@ -68,40 +125,26 @@ export declare class RTCRtpSender {
68
125
  private headerExtensions;
69
126
  private disposeTrack?;
70
127
  private sendEncodings;
71
- private lastSRtimestamp?;
72
- private lastSentSRTimestamp?;
73
- private ntpTimestamp;
74
- private rtpTimestamp;
75
- private octetCount;
76
- private packetCount;
77
- private headerBytesSent;
78
- private rtt?;
79
- private totalRoundTripTime;
80
- private roundTripTimeMeasurements;
81
- private retransmittedPacketsSent;
82
- private retransmittedBytesSent;
83
- private nackCount;
84
- private pliCount;
85
- private firCount;
128
+ private readonly stats;
86
129
  /**
87
130
  * Last FIR sequence number per (FIR sender SSRC, FCI target SSRC): RFC 5104
88
131
  * 4.3.1.1 keeps one sequence number space per pair.
89
132
  */
90
133
  private lastFirSequenceNumbers;
91
- private remotePacketsLost?;
92
- private remoteFractionLost?;
93
134
  receiverEstimatedMaxBitrate: bigint;
94
- private sequenceNumber?;
95
- private timestamp?;
96
- private timestampOffset;
97
- private seqOffset;
98
- private rtpContinuityPending;
99
- private pendingTimestampStep;
135
+ private readonly continuity;
100
136
  private rtpCache;
101
- private pendingRtp;
102
- private drainingPendingRtp;
137
+ private readonly pendingRtp;
138
+ /**
139
+ * Bumped on replaceTrack / detachTrack / onSourceChanged. Media accepted
140
+ * under an older epoch is dropped before it can allocate seq/timestamp, so
141
+ * it neither consumes the new source's continuity offset nor leaks out
142
+ * after `replaceTrack(null)`.
143
+ */
144
+ private sourceEpoch;
145
+ /** Aborted on every source epoch bump to wake probe / pacing waits. */
146
+ private sourceEpochCancel;
103
147
  private readonly pendingRtpEnabled;
104
- private readonly pendingRtpMaxLength;
105
148
  codec?: RTCRtpCodecParameters;
106
149
  private negotiatedCodecs;
107
150
  private sendPrimaryCodec?;
@@ -122,6 +165,44 @@ export declare class RTCRtpSender {
122
165
  get streamId(): string | undefined;
123
166
  set streamId(value: string | undefined);
124
167
  setDtlsTransport(dtlsTransport: RTCDtlsTransport): void;
168
+ /**
169
+ * Replace the send-side bandwidth estimator used for TWCC-driven BWE.
170
+ *
171
+ * Default is the lightweight {@link LightweightBandwidthEstimator}. Pass e.g.
172
+ * `new GccBandwidthEstimator()` to use Google Congestion Control.
173
+ *
174
+ * Behavior on swap:
175
+ * 1. Bumps the estimator generation so in-flight sends discard
176
+ * `rtpPacketSent` delivery and in-flight {@link maybeInjectProbePadding}
177
+ * loops exit (cancelled — no packets to disposed / previous estimator).
178
+ * 2. Stops delivering `rtpPacketSent` / `receiveTWCC` to the previous instance.
179
+ * 3. Unbinds the stable {@link onAvailableBitrate} bridge, then `dispose()`/`reset()` the old instance.
180
+ * 4. **Always** `reset()` the injected `impl` so a previously used instance
181
+ * starts clean (no implicit state merge), then rebinds the bridge.
182
+ * 5. Clears {@link pendingUntrackedBytes} and pacing credit so the next
183
+ * estimator's first `SentInfo.priorUnackedBytes` is 0.
184
+ *
185
+ * Subscriptions to {@link onAvailableBitrate} on this sender are preserved.
186
+ * Re-subscribe algorithm-specific events on the new concrete instance.
187
+ */
188
+ setBandwidthEstimator(impl: BandwidthEstimator): void;
189
+ /**
190
+ * A new DTLS transport has its own transport-wide sequence space and path:
191
+ * drop the estimator's path state ({@link EstimatorBinding.resetForNewRoute},
192
+ * which also bumps the generation so in-flight sends on the old transport
193
+ * do not report their old TSN) and the pacing / unacked leftovers.
194
+ */
195
+ private resetBweForNewTransport;
196
+ /** Drop pacing leftover and unacked bytes that belonged to the previous BWE generation. */
197
+ private resetBweSendTransientState;
198
+ /** Initial probes wait until DTLS can send; also on a swap onto a connected sender. */
199
+ private syncNetworkAvailability;
200
+ /**
201
+ * Effective send pacing rate (bps): estimator estimate, raised to the active
202
+ * probe target while probing. 0 when unknown. Lightweight returns 0 from
203
+ * {@link BandwidthEstimator.getPacingBitrateBps} so media is unpaced.
204
+ */
205
+ get pacingBitrateBps(): number;
125
206
  get redDistance(): number;
126
207
  set redDistance(n: number);
127
208
  /** Internal: the negotiated send parameters, for a negotiation baseline. */
@@ -148,25 +229,10 @@ export declare class RTCRtpSender {
148
229
  /** Internal: return to a negotiation baseline's send parameters. */
149
230
  restoreSendParams(snapshot: ReturnType<RTCRtpSender["snapshotSendParams"]>): void;
150
231
  prepareSend(params: RTCRtpSendParameters): void;
151
- /**
152
- * The negotiated direction in effect (the answer's, or a pranswer's while
153
- * it is pending) does not include sending: RTP is dropped, not queued.
154
- * @internal
155
- */
156
- sendSuppressed: boolean;
157
- /** @internal Follow the transceiver's currentDirection. */
158
- setSendSuppressed(suppressed: boolean): void;
159
232
  private canSendRtp;
160
- private settlePendingRtp;
161
- private discardPendingRtp;
162
- private enqueuePendingRtp;
163
233
  /**
164
- * Send queued RTP once DTLS is connected and a codec is set. Used only when
165
- * pending RTP is enabled: `writeRtp` / `sendRtp` may run before ICE/DTLS
166
- * completes; dropping those packets would lose the start of a media source.
167
- * `drainingPendingRtp` blocks re-entry while `dispatchRtp` is awaited;
168
- * packets enqueued during that wait are drained by the recursive call after
169
- * the flag is cleared.
234
+ * Send queued RTP once DTLS is connected and a codec is set.
235
+ * Drain uses {@link sendRtpInternal} so GCC pacing / TWCC stay on the send path.
170
236
  */
171
237
  private drainPendingRtp;
172
238
  registerTrack(track: MediaStreamTrack): void;
@@ -182,31 +248,89 @@ export declare class RTCRtpSender {
182
248
  keepTrack?: boolean;
183
249
  }): void;
184
250
  runRtcp(): Promise<void>;
185
- /**
186
- * Send an RTP packet. Pending RTP is disabled by default: the packet is
187
- * written immediately if DTLS is connected and a codec is set, otherwise
188
- * dropped.
189
- *
190
- * When pending RTP is enabled, the packet is queued until it can be sent.
191
- * The returned promise then settles for this packet only:
192
- * - resolve: DTLS send completed, or the packet was dropped by `stop()`,
193
- * `replaceTrack(null)`, or pending-queue overflow
194
- * - reject: DTLS send threw while writing this packet
195
- *
196
- * Later `sendRtp()` calls stay pending until their own packet is sent or
197
- * dropped, even if a drain is already in progress.
198
- */
199
- sendRtp(rtp: Buffer | RtpPacket): Promise<void>;
251
+ /** Sender Report for the instant `nowMonotonicMs` ({@link SenderStatistics.buildSenderReport}). */
252
+ private buildSenderReport;
200
253
  /**
201
254
  * Schedule RTP continuity rewrite for the next packet that is actually sent.
202
255
  * The header argument is kept for API compatibility and is not used to compute
203
256
  * offsets. `discontinuity` does not change sequence or timestamp mapping.
204
257
  * `timestampStep` (default 1) is the only way to choose the timestamp increment
205
258
  * at the source-switch boundary.
259
+ *
260
+ * Use this (or `MediaStreamTrack.notifySourceChanged`) when the RTP written
261
+ * into this sender's track switches to another upstream source: the next
262
+ * packet continues from the last sent one (`seq + 1`, `timestamp + step`)
263
+ * and queued packets of the old source are dropped. Apps that send RTP
264
+ * without `RTCRtpSender` (for example through `SrtpSession`) can use
265
+ * `RtpTimelineRewriter` from werift-rtp instead.
206
266
  */
207
267
  replaceRTP(header: Pick<RtpHeader, "sequenceNumber" | "timestamp">, discontinuity?: boolean, timestampStep?: number): void;
268
+ /**
269
+ * Start a new source epoch and drop queued media of the previous source.
270
+ * A packet already past sequence allocation (in its DTLS write) completes;
271
+ * one still waiting on pacing/probe is dropped by {@link sendRtpInternal}.
272
+ */
273
+ private invalidateQueuedSource;
274
+ private isStaleSource;
275
+ /**
276
+ * Abort signal for a send wait: sender stop, estimator swap, plus source
277
+ * switch for media.
278
+ */
279
+ private sendWaitSignal;
280
+ /** A waiting send may still go out: not stopped, same estimator, same source. */
281
+ private isSendAlive;
208
282
  private scheduleRtpContinuity;
209
- private dispatchRtp;
283
+ private dispatchMedia;
284
+ /**
285
+ * Lightweight / disabled estimators neither pace nor probe, so RTP is written
286
+ * straight through as before the BWE abstraction: no FIFO, no queue limit,
287
+ * and no wait before the DTLS write. Pacing estimators (GCC) go through
288
+ * {@link outgoing}. A FIFO still draining after an estimator swap
289
+ * keeps its order by queuing behind it.
290
+ */
291
+ private dispatchOutgoing;
292
+ /**
293
+ * Send immediately by default or queue until DTLS is ready when pending RTP
294
+ * is enabled. Each call settles only after its own packet is sent or dropped.
295
+ */
296
+ sendRtp(rtp: Buffer | RtpPacket): Promise<void>;
297
+ /** True when transport-wide CC header extension is negotiated. */
298
+ private isTransportCcNegotiated;
299
+ /**
300
+ * Padding needs an estimator that asks for it, TWCC so feedback can see it,
301
+ * and a negotiated RTX stream to carry it. Without RTX no padding is sent
302
+ * (see `GCC_KNOWN_DIFFERENCES`): media sequence numbers stay untouched.
303
+ */
304
+ private canSendPadding;
305
+ /**
306
+ * Inject RTP padding packets while a GCC probe cluster is active and media
307
+ * alone has not yet filled min packets / min bitrate×duration.
308
+ *
309
+ * Responsibility split:
310
+ * - Estimator (`ProbeController` / `pendingProbePaddingPackets`) decides need
311
+ * - Sender generates padding-only RTP on the RTX SSRC with a TWCC seq +
312
+ * `isProbation` and paces them
313
+ */
314
+ maybeInjectProbePadding(): Promise<number>;
315
+ /**
316
+ * pin padding_rate while LossBased is `kIncreaseUsingPadding`.
317
+ * Regular RTP padding (not probe/probation). Probe padding takes priority.
318
+ */
319
+ maybeInjectLossPadding(): Promise<number>;
320
+ private createPaddingInjector;
321
+ /** Padding-only RTP on the RTX SSRC / payload type ({@link createRtxPaddingPacket}). */
322
+ private createPaddingRtpPacket;
323
+ private sendRtpInternal;
324
+ /** pin BitrateProber next_probe_time wait ({@link waitForProbeSendTime}). */
325
+ private awaitProbeSendTime;
326
+ /**
327
+ * Token-bucket wait against {@link pacingBitrateBps} for **media**.
328
+ * Probe packets use {@link awaitProbeSendTime} instead.
329
+ * Returns false if the sender is stopped, the estimator is swapped
330
+ * (`generation` changes), or the packet's source is replaced/detached while
331
+ * waiting (budget is not consumed then).
332
+ */
333
+ private awaitPacingBudget;
210
334
  /**
211
335
  * @param firEntries Internal: the FCI entries of a FIR the router resolved to
212
336
  * this sender (see `KeyFrameRequestRouting`). Defaults to the entries for
@@ -221,9 +345,6 @@ export declare class RTCRtpSender {
221
345
  setParameters(params: {
222
346
  encodings?: Array<Record<string, unknown>>;
223
347
  }): void;
224
- private get outboundRtpStatsId();
225
- private get mediaSourceStatsId();
226
- private get remoteInboundRtpStatsId();
227
348
  getStatsRootIds(): string[];
228
349
  collectStats(timestamp: number): RTCStats[];
229
350
  getStats(): Promise<RTCStatsReport>;