Read once: a link passed on is fetched from the site once, for the putter's player and the relay
Before, the member passing a page link on downloaded it twice, independently: their mpv straight from the CDN and the relay's pulls again, with a different format pick and without yt-dlp's cookies. The two drifted (the putter played on while viewers stalled, or the reverse) and doubled the connections the CDN saw. Now one SharedSource per track reads the site once (resuming after cuts, backing off on 412/429/5xx and silence) into a bounded buffer (64 MiB ahead, 16 behind) that serves both the putter's mpv through a loopback endpoint and the server's pulls; the putter plays the relay's own format pick, and the relay sends yt-dlp's cookies. Up next's warm relay uses the same reader. Pieces tracks (HLS/DASH) keep two fetches for now. Measured in the opt-in e2e: half the CDN traffic, no 412s under a lockout CDN, viewer seeks 0.29 s instead of 4 s there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7715dc479a
commit
ec0849eb01
19 files changed
+1894
-101
No files matched your search
@@ -343,6 +343,13 @@ void main() {
|
||||
final relay = stateMediaRelay(a.serverState.peek()!);
|
||||
expect(relay?.queueId, id, reason: 'the warm relay became the media\'s');
|
||||
expect(relay?.fetch, mode == LinkRelay.server);
|
||||
if (mode == LinkRelay.me) {
|
||||
// Read once: alice's preload and the warm relay read one shared
|
||||
// reader, and the swap carried it on as the media's.
|
||||
final one = a.media.shared.currentFor(linkUrl);
|
||||
expect(one, isNotNull, reason: 'alice reads the link once');
|
||||
expect(one!.bytesIn, greaterThan(0));
|
||||
}
|
||||
if (preload) {
|
||||
for (final x in all.values) {
|
||||
expect(x.switchTrace.of(x.serverState.peek()!.mediaId), contains(SwitchTrace.preloaded),
|
||||
|
||||
Reference in new issue
Block a user