@torrent-tv/proxy 2.88.6 → 2.89.1
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/AGENTS.md +21 -12
- package/CHANGELOG.md +2285 -2267
- package/assets/calibration/audio/NOTICE.md +19 -19
- package/assets/calibration/audio/manifest.json +98 -98
- package/docs/container-architecture.md +77 -22
- package/docs/playback-start-forecast.md +56 -56
- package/main2.cpuprofile +1 -0
- package/package.json +1 -1
- package/scripts/build-audio-samples.mjs +31 -31
- package/server.js +42 -27
- package/services/encode/OutputOpening.js +5 -4
- package/services/encode/audio-calibration.js +67 -67
- package/services/encode/audio-work-rate.js +15 -15
- package/services/media/ContainerOrchestrator.js +99 -46
- package/services/media/KeyframeTables.js +61 -21
- package/services/media/SubtitleCues.js +255 -183
- package/services/media/container/AviContainer.js +5 -3
- package/services/media/container/Container.js +66 -43
- package/services/media/container/ContainerFactory.js +8 -26
- package/services/media/container/MatroskaContainer.js +719 -1182
- package/services/media/container/Mp4Container.js +83 -73
- package/services/media/container/ebml-stream.js +174 -0
- package/services/media/container/matroska-clusters.js +1165 -0
- package/services/media/container/unavailable.js +77 -0
- package/services/media/tracks/ContainerTrack.js +9 -0
- package/services/media/tracks/TextSubtitleTrack.js +9 -1
- package/services/server/playback-readiness.js +516 -516
- package/services/torrent/worker/client.js +836 -765
- package/services/torrent/worker/held-bytes.js +84 -8
- package/services/torrent/worker/worker.js +10 -2
- package/services/transport/data-channel-handler.js +7 -3
- package/services/viewer/PriorityMap.js +31 -0
- package/test/audio-calibration.test.js +23 -23
- package/test/coalesce.test.js +39 -0
- package/test/held-read-ownership.test.js +77 -0
- package/test/helpers/held-file.js +50 -2
- package/test/helpers/matroska-file.js +296 -0
- package/test/keyframe-table-budget.test.js +21 -0
- package/test/matroska-cluster-discovery.test.js +323 -0
- package/test/reads-not-yet-arrived.test.js +218 -0
- package/test/subtitle-cue-walk.test.js +16 -1
- package/test/subtitle-plan-waits.test.js +125 -0
- package/test/subtitle-track-numbering.test.js +8 -3
- package/test/viewer-starts-on-map.test.js +27 -0
- package/test/whole-file-held-read.test.js +30 -0
- package/utils/coalesce.js +41 -0
package/AGENTS.md
CHANGED
|
@@ -93,17 +93,25 @@ are recorded in `docs/browser-proxy-contract.md`.
|
|
|
93
93
|
`ExternalSubtitleFile`. Spec-accurate flags (FlagForced only on subtitles per
|
|
94
94
|
RFC 9559 §5.1.4.1, FlagOriginal/Commentary only on audio, tkhd
|
|
95
95
|
track_enabled / alternate_group, elng BCP47).
|
|
96
|
-
- `media/` application files: `ContainerOrchestrator` (detect +
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
- `media/` application files: `ContainerOrchestrator` (detect + the ONE
|
|
97
|
+
container per file, `containerFor`/`getTracks`/`getMediaInfo`/`getKeyframeIndex`;
|
|
98
|
+
the container keeps its own reading of each element it states — the Segment
|
|
99
|
+
layout, Tracks, Cues, MP4's `moov` — once it has been read), `KeyframeTables`,
|
|
100
100
|
`SubtitleOrchestrator` (the track list and the cues behind
|
|
101
101
|
`Container` tracks, warm/push — it is handed the walk, and `server.js` is
|
|
102
|
-
what puts the two together), `SubtitleCues` (the
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
what puts the two together), `SubtitleCues` (the plan, the found-order
|
|
103
|
+
cursor, one walk of a file at a time, taking back withdrawn cues). It uses
|
|
104
|
+
the file's one container — it no longer builds its own. The walk itself is
|
|
105
|
+
`MatroskaContainer.readHeldCues` over `container/matroska-clusters.js` (which
|
|
106
|
+
also finds clusters the Cues table does not name) and
|
|
107
|
+
`Mp4Container.readHeldSamples`; what the torrent supplies is `held-bytes.js`
|
|
108
|
+
— which ranges are downloaded whole, and a read of one that never fetches
|
|
109
|
+
and answers at once with nothing where the range is not whole.
|
|
110
|
+
- **A read whose bytes have not arrived is not an answer about the file.**
|
|
111
|
+
Every container read is strict (`container/unavailable.js`): every byte, or
|
|
112
|
+
`BytesUnavailable`. A value, a proven absence, or a refusal of ours with its
|
|
113
|
+
reason may be kept; "not here yet" never is — not by a container, not by
|
|
114
|
+
`ContainerOrchestrator`, not by `KeyframeTables`, not by `SubtitleCues`.
|
|
107
115
|
**`KeyframeTables` is where a file's keyframe table lives and the only thing
|
|
108
116
|
that reads one.** The table is `container/KeyframeTable.js`, ONE object per
|
|
109
117
|
file, handed out rather than copied — so a read that lands after a session
|
|
@@ -113,9 +121,10 @@ are recorded in `docs/browser-proxy-contract.md`.
|
|
|
113
121
|
file that must be re-encoded for ever from a passing shortage of bytes off
|
|
114
122
|
the swarm. One read per file whoever asks, the second asker joins the first,
|
|
115
123
|
each caller's wait is bounded by the measured `KEYFRAME_TABLE_BUDGET_MS`
|
|
116
|
-
while the READ is not, and a read that threw
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
while the READ is not, and a read that threw — `BytesUnavailable` included —
|
|
125
|
+
is never recorded as an answer; it is read again when pieces of the file
|
|
126
|
+
arrive (`readAgainIfUnanswered`). It is the ONLY store of the keyframe
|
|
127
|
+
answer; the container keeps the Cues reading the times are taken from. The second reader is the packet probe in
|
|
119
128
|
`media/keyframe-probe.js`, which decodes rather than parsing; the fuller of the
|
|
120
129
|
two answers is the one that stands (`media/keyframe-probe.js`).
|
|
121
130
|
- `server/controllers/` — interface layer: `PlaybackController` / `SubtitleController`
|