@torrent-tv/proxy 2.9.34 → 2.9.35
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.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/services/webrtc-manager.js +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2.9.35
|
|
2
|
+
|
|
3
|
+
- **Fix**: Large torrents (many files / seasons) no longer fail with "Trying to send message larger than max-message-size" when a file is picked. The browser sends the source registration body — the base64-encoded `.torrent` — in a single data-channel message; a big multi-season pack's `.torrent` carries thousands of piece hashes (e.g. Poirot, 13 seasons: 420 KB → ~560 KB base64), exceeding libdatachannel's default advertised limit of 256 KB, so the browser's `channel.send()` threw. The proxy now advertises a 16 MB `a=max-message-size`, so the browser permits the large send. Responses (proxy→browser) were already safe — they stream in small chunks. Verified the SDP now carries `a=max-message-size:16777216` (was `262144`).
|
|
4
|
+
|
|
1
5
|
## 2.9.34
|
|
2
6
|
|
|
3
7
|
- **New**: Cold-start reduction (OpenSpec change `cold-start`). Creating a transcode session no longer runs a second full ffmpeg input scan: the playback planner caches the media info (duration/resolution/fps/start-time/HDR) parsed from the probe it already ran, and `createSession` reuses it (falling back to its own probe only when the cache cannot serve — e.g. after a restart, or a missing critical field). The banner parsers now live in a shared `ffmpeg-banner.js` so both sides parse identically. Once a plan probe succeeds the proxy also warms the START of the file body (~16 MB, fire-and-forget) so the first segment's encode reads downloaded data instead of waiting on pieces. Session startup is now measurable in the log: `cold-start <id>: media-info=<ms> (cached|probed) keyframes=<ms|skipped> create-total=<ms>` and, once per session, `cold-start <id>: first-segment ready +<ms>`.
|
package/package.json
CHANGED
|
@@ -25,6 +25,18 @@ const ICE_SERVERS = ["stun:stun.l.google.com:19302", "stun:stun.cloudflare.com:3
|
|
|
25
25
|
// values without bloating the SDP.
|
|
26
26
|
const PORT_PREDICTION_WINDOW = 16;
|
|
27
27
|
|
|
28
|
+
// Max size of a single data-channel message the proxy advertises (SDP
|
|
29
|
+
// `a=max-message-size`) and will accept. The browser caps `channel.send()` at
|
|
30
|
+
// the REMOTE's advertised value, so this is what lets the browser send a large
|
|
31
|
+
// request body in one message — notably registering a source, whose body is
|
|
32
|
+
// the base64-encoded .torrent. A big multi-season pack's .torrent (thousands of
|
|
33
|
+
// piece hashes) can be hundreds of KB (e.g. Poirot: 420 KB → ~560 KB base64),
|
|
34
|
+
// which exceeds libdatachannel's ~256 KB default and made `send()` throw
|
|
35
|
+
// "message larger than max-message-size". 16 MB is a generous ceiling (memory
|
|
36
|
+
// is allocated per actual message, not reserved). Responses (proxy→browser)
|
|
37
|
+
// are already safe — they stream in small reader-sized chunks.
|
|
38
|
+
const MAX_DC_MESSAGE_BYTES = 16 * 1024 * 1024;
|
|
39
|
+
|
|
28
40
|
/**
|
|
29
41
|
* Build predicted srflx ICE candidates for a symmetric NAT.
|
|
30
42
|
*
|
|
@@ -195,7 +207,7 @@ export function createWebRtcManager({ sendSignal, onDataChannel, onLog, udpPort,
|
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
// Base PeerConnection config shared by every session.
|
|
198
|
-
const pcConfig = { iceServers: ICE_SERVERS };
|
|
210
|
+
const pcConfig = { iceServers: ICE_SERVERS, maxMessageSize: MAX_DC_MESSAGE_BYTES };
|
|
199
211
|
|
|
200
212
|
// Single-port UDP mux: create ONE persistent listener that owns the shared
|
|
201
213
|
// UDP socket for the proxy's whole lifetime, then have every PeerConnection
|