aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-03 12:53:35 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-03 14:24:54 +0200
commitcf8345386996c561f176049b2f83fbd07956995e (patch)
treeda50f4f3329d519f06b8bf06483b15fa2ae9ca64 /packages/meshbay-hub
parente7d663b76e58354d6a1b58f40624427d5ae660c8 (diff)
downloadmeshbay-cf8345386996c561f176049b2f83fbd07956995e.tar.gz
fix(android): the cast relay spools a receiver's lead to disk
Fragments are 5-10 MB at a film's bitrate; dropped past 8 MB in memory, the TV froze for their length. Each receiver now reads from its own spool file, deleted with it; nothing is dropped short of a disk bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub')
-rw-r--r--packages/meshbay-hub/tests/test_android_cast.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/meshbay-hub/tests/test_android_cast.py b/packages/meshbay-hub/tests/test_android_cast.py
index 0ff383a..a346d15 100644
--- a/packages/meshbay-hub/tests/test_android_cast.py
+++ b/packages/meshbay-hub/tests/test_android_cast.py
@@ -53,7 +53,6 @@ def test_the_relay_keeps_the_desktop_mitigations():
for name in ("RING_CAP", "PORT_BASE", "PORT_COUNT"):
js = re.search(rf"const {name} = (\d+);", desktop).group(1)
assert re.search(rf"const val {name} = {js}\b", relay), name
- assert "BACKPRESSURE_HIGH = 8L * 1024 * 1024" in relay
assert "InetSocketAddress(address, PORT_BASE + i)" in relay, "bound to the LAN address"
# Code, not comments: the comment saying "never 0.0.0.0" is not a bind.
code = re.sub(r"/\*.*?\*/", "", relay, flags=re.S)
@@ -65,6 +64,21 @@ def test_the_relay_keeps_the_desktop_mitigations():
assert serve.index('method == "OPTIONS"') < serve.index('query["t"] != token')
+def test_what_a_receiver_has_not_read_waits_on_disk():
+ """The desktop drops a fragment once 8 MB wait for a receiver; a fragment
+ is 5 to 10 MB at a film's bitrate, so the television froze for its length
+ (measured: three dropped in the first fifteen seconds). Here the lead waits
+ in a spool file per receiver, deleted with it, and is dropped only past a
+ disk bound."""
+ relay = _read(CAST / "CastRelay.kt")
+ assert "BACKPRESSURE_HIGH" not in relay
+ assert "RandomAccessFile(file, \"rw\").channel" in relay
+ assert "c.waiting() > spoolLimit()" in relay
+ assert "SPOOL_MAX_BYTES = 2L * 1024 * 1024 * 1024" in relay
+ assert "file.delete()" in relay
+ assert 'java.io.File(context.cacheDir, "cast-relay")' in _read(CAST / "CastChannels.kt")
+
+
def test_the_backlog_is_bounded_in_bytes():
"""A fragment is a segment, megabytes at a film's bitrate: 64 of them killed
the application with an OutOfMemoryError on the emulator."""