From 535366b90c170691842311a3898a3d83d744ef75 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 02:32:59 +0200 Subject: refactor(node): move video streaming out of webrtc_server StreamingMixin in transport/webrtc/apps/streaming.py: stream credit, handover, the transcode slots and _stream_video_inner, moved unchanged. Co-Authored-By: Claude Opus 5.5 --- docs/MESHBAY_NODE_PROTOCOL.md | 6 +++--- docs/transfers-v1.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/MESHBAY_NODE_PROTOCOL.md b/docs/MESHBAY_NODE_PROTOCOL.md index c3db019..4e0983d 100644 --- a/docs/MESHBAY_NODE_PROTOCOL.md +++ b/docs/MESHBAY_NODE_PROTOCOL.md @@ -2307,12 +2307,12 @@ LP(x) = uint32be(len(x)) || x every field, no exceptions | `MAX_LEASELESS_IN_FLIGHT` / `LEASELESS_IDLE_SECS` | 12 files / 60 s | ” | | `TRANSFER_SWEEP_SECS` | 15 s | `webrtc_server.py` | | Lease watchdog (client) | 60 s, then re-ask | `transport.js` | -| `STREAM_SEGMENT_SIZE` | 256 KiB | `webrtc_server.py` | +| `STREAM_SEGMENT_SIZE` | 256 KiB | `webrtc/apps/streaming.py` | | `STREAM_MAX_CREDIT` | 256 | ” | | `STREAM_CREDIT_TIMEOUT` / `_POLL` | 120 s / 3 s | ” | | Client stream credits | 24 | `transport.js` | -| `MAX_CONCURRENT_TRANSCODES` | 8 | `webrtc_server.py` | -| Link preview rate | 15/conn, 60/node per 60 s; cache 1 h × 256 | ” | +| `MAX_CONCURRENT_TRANSCODES` | 8 | `webrtc/apps/streaming.py` | +| Link preview rate | 15/conn, 60/node per 60 s; cache 1 h × 256 | `webrtc_server.py` | | ICE gathering deadline | 4 s | `transport.js` | | Signaling: max SDP, pending per user, rate | 16 KiB, 3, 30/min, 15 s answer timeout | `api/signaling.py` | | GEK | 256-bit, node CSPRNG | `crypto.py` | diff --git a/docs/transfers-v1.md b/docs/transfers-v1.md index f99424f..13e4869 100644 --- a/docs/transfers-v1.md +++ b/docs/transfers-v1.md @@ -67,7 +67,7 @@ So there is already a resume story here, it is just not reachable — and there is already a leak. **Video streaming is capped, and its cap is a good model.** `_stream_video` -(`webrtc_server.py:5230`) takes `ctx["_transcode_sem"]`, refuses with +(`webrtc/apps/streaming.py`) takes `ctx["_transcode_sem"]`, refuses with `"Server busy, retry shortly"` when it is empty, and every hard-won lesson in this repo about slots — `_replace_stream`, `shutdown_tasks()`, `_spawn()` and the garbage-collected task, `await proc.wait()` after `kill()` — is a lesson @@ -76,7 +76,7 @@ about *not losing a slot*. That history is why §5 exists. **One bug found while reading, in scope for this work.** `ops.py:1362-1365` hot-swaps the stream cap by assigning `webrtc._stream_sem` — an attribute that does not exist. The real semaphore is `ctx["_transcode_sem"]` -(`webrtc_server.py:5220`), and `hasattr(webrtc, '_stream_sem')` is always +(`_transcode_semaphore`, `webrtc/apps/streaming.py`), and `hasattr(webrtc, '_stream_sem')` is always False, so **changing `max_concurrent_streams` from the Node page has never taken effect without a restart**, contrary to §2.11 of draft v6. Two more hot-swappable caps are about to be added next to it; fix it with one shared -- cgit v1.2.3