TASK 48 item 1: bundle ffmpeg — the app no longer downloads an executable
Store policy 10.2.2 forbids dynamic code inclusion, and this was the only third-party binary the app ever downloaded and ran. It had already failed in production: the pin aged out of BtbN's 14-day retention and the download 404'd on the creator's first real recording attempt (2026-09-01). Bundling kills that failure class permanently and deletes the startup network dependency. - scripts/fetch-ffmpeg.sh populates a gitignored ./ffmpeg from a pinned month-end BtbN LGPL-shared artifact, SHA-256 verified before extraction, idempotent, FFMPEG_ZIP= override. 135 MB of DLLs in git would tax every commit on this 9p tree; the URL + hash are the audit trail LGPL §6 wants. - ytLive.csproj copies ffmpeg\** to output and publish (Always), and a GuardBundledFfmpeg target fails the BUILD if the folder is missing, so a fresh clone finds out before a take rather than during one. - FfmpegLocator loses the downloader, the zip extraction and the %APPDATA%\ytLlive\tools cache. Order is now bundle -> PATH, deliberately inverted: a PATH ffmpeg may be a different major version or a GPL build, and the bundle is what was pinned, license-vetted and tested. A missing bundle throws loudly; the old "found something on disk" path could satisfy a missing bundle with a stale copy, and silent drift is the worst failure mode for a dependency certification inspects. - ffplay.exe (18 MB) is not shipped; nothing calls it. - THIRD-PARTY-NOTICES.txt: "downloads" -> "bundled" throughout, and the stale build tag autobuild-2026-08-09-13-03 — the tag that 404'd — corrected to autobuild-2026-08-31-13-27 with the exact artifact name and archive hash. OpenH264 made precise: compiled INTO avcodec-63.dll, no separate binary. Checked whether other third-party binaries needed bundling: no. e_sqlite3.dll and WebView2Loader.dll already ship via NuGet into runtimes\win-x64\native\, OpenH264 is inside avcodec-63.dll, the rest are managed. Two gaps remain that bundling cannot fix, recorded in the map: the WebView2 Evergreen runtime is a machine prerequisite (TASK 48 item 2), and Velopack's updater downloads and executes, so its teardown is a compliance action. Tests: 16 locator facts, suite 379/379, 0 warnings. The integration test runs the bundled ffmpeg -version, which is the only assertion that proves the sibling libav*.dll resolved — presence checks pass with the DLLs missing and a shared build then fails to start. TheLocatorCarriesNoNetworkCapability keeps 10.2.2 from rotting back. Analysis: TASKS/research-store-certification.md §4.
This commit is contained in:
@@ -113,6 +113,18 @@ collaboration, not autonomous code generation.
|
||||
|
||||
## Run
|
||||
|
||||
**First time on a fresh clone (or if `ffmpeg/` was deleted) — this is REQUIRED, not optional:**
|
||||
|
||||
```bash
|
||||
./scripts/fetch-ffmpeg.sh # ~65 MB once; verifies SHA-256, extracts 9 files into ./ffmpeg
|
||||
```
|
||||
|
||||
FFmpeg is **bundled, never downloaded at runtime** (Windows Store policy 10.2.2 — the old runtime
|
||||
download 404'd on 2026-09-01 and would fail certification). The binaries are gitignored because
|
||||
135 MB of DLLs in git would tax every commit on this 9p tree; the pinned URL + SHA-256 in the script
|
||||
are the audit trail. `ytLive.csproj`'s `GuardBundledFfmpeg` target **fails the build** with that
|
||||
exact instruction if the folder is missing. `FFMPEG_ZIP=<path>` reuses a pre-downloaded archive.
|
||||
|
||||
```bash
|
||||
# From WSL, ALWAYS use the Windows dotnet host — never Linux `dotnet` for this project:
|
||||
"/mnt/c/Program Files/dotnet/dotnet.exe" build "C:\Users\gramp\Documents\Code\projects\ytLive\ytLive.csproj"
|
||||
@@ -619,37 +631,58 @@ stays XAML (editing view); the compositor is the output view.
|
||||
resolver in the encoder step, not the compositor step. The master buffer (the compositor's return
|
||||
value) is the seam a future D3D11 compositor would honor identically.
|
||||
|
||||
### FFmpeg locator (TASK 4 ship step 2 — shipped 2026-08-10, plan in TASKS.md)
|
||||
### FFmpeg locator (TASK 4 ship step 2 — shipped 2026-08-10; **rewritten to BUNDLED 2026-09-28**, plan in TASKS.md)
|
||||
|
||||
The encoder's one external dependency is `ffmpeg.exe`; it's never shipped in the repo. `IFfmpegLocator`
|
||||
resolves an absolute path on demand: **PATH probe first** (the user's own install wins — their choice,
|
||||
their responsibility), then the cache (`%APPDATA%\ytLlive\tools\ffmpeg.exe`), then a **pinned** BtbN
|
||||
LGPL-**shared** win64 zip (~75 MB) from which `ffmpeg.exe` **and the `libav*.dll` family** are extracted
|
||||
(staged temp-write + move so a crash never corrupts the cache; Windows resolves the DLLs from the exe's
|
||||
own directory). BtbN LGPL-shared (not gyan.dev, not static): it drops GPL-only libx264/x265 while keeping
|
||||
The encoder's one external dependency is `ffmpeg.exe`. **It is BUNDLED — never downloaded, never
|
||||
fetched at runtime.** `IFfmpegLocator` resolves an absolute path on demand: **the bundle first**
|
||||
(`<AppContext.BaseDirectory>\ffmpeg\ffmpeg.exe`), then **PATH** as the escape hatch for someone who
|
||||
deliberately installed their own. The order is the opposite of the original ("the user's own install
|
||||
wins") on purpose: a PATH `ffmpeg` may be a different major version or a **GPL** build, and the
|
||||
bundle is the one that was pinned, license-vetted and tested. If neither hits, it throws a loud
|
||||
`IOException` naming the missing folder and the fetch script — the old "found something on disk"
|
||||
cache path is gone deliberately, because silently satisfying a missing bundle with a stale copy is
|
||||
exactly the silent drift a certification-gated dependency must not have.
|
||||
|
||||
**The bundle is not in git** (135 MB of incompressible DLLs would tax every commit on this
|
||||
9p-bridged tree). `scripts/fetch-ffmpeg.sh` populates `./ffmpeg` from a pinned month-end BtbN
|
||||
LGPL-**shared** win64 artifact, **verifies SHA-256 before extracting**, and is idempotent; set
|
||||
`FFMPEG_ZIP=<path>` to reuse a pre-downloaded archive. `ytLive.csproj` copies `ffmpeg\**` to the
|
||||
output (`CopyToPublishDirectory="Always"` for the MSIX package) and the `GuardBundledFfmpeg` target
|
||||
**fails the build** if the folder is absent, so a fresh clone finds out before the creator presses
|
||||
Record rather than during a take. `ffmpeg.exe` + `ffprobe.exe` + the `libav*.dll` family must stay in
|
||||
one folder — Windows resolves a shared build's DLLs from the executable's own directory.
|
||||
`ffplay.exe` (18 MB) is deliberately **not** shipped; nothing calls it.
|
||||
|
||||
BtbN LGPL-shared (not gyan.dev, not static): it drops GPL-only libx264/x265 while keeping
|
||||
NVENC/QSV/AMF + libopenh264 + native AAC, and dynamic linking means LGPL compliance is "license text +
|
||||
source offer" with no static-relink (§6) material — see the Licensing guardrails below. The pin is a
|
||||
dated autobuild tag (immutable); BtbN retention keeps the last 14 daily + each month-end for 2 years, so
|
||||
a cold cache can outlive the pin → the seam throws a clear, logged error (recoverable; the pin is one
|
||||
const). Constructor-injected search dirs / tools dir / downloader (`Func<string, CancellationToken,
|
||||
Task<byte[]>>`) keep it hermetic: tests fake the network with a real in-memory zip. Constructed in the
|
||||
encoder step (not yet — this PR ships the seam + impl + tests only).
|
||||
source offer" with no static-relink (§6) material — see the Licensing guardrails below. libopenh264
|
||||
is **compiled into `avcodec-63.dll`** (verified 2026-09-28: the encoder is registered there, and there
|
||||
is no separate OpenH264 binary to ship), so Cisco's BSD terms + patent grant ride along inside item 1
|
||||
of `THIRD-PARTY-NOTICES.txt`. Pin: `autobuild-2026-08-31-13-27` (month-end on purpose — BtbN keeps
|
||||
~14 dailies but month-end builds ~2 years; a daily pin is what 404'd, see below).
|
||||
|
||||
**⛔ The pinned-download design is now formally a defect, not a cold-start edge case (2026-09-27).**
|
||||
It **failed in production on 2026-09-01** — the previous daily pin aged out of BtbN's 14-day
|
||||
retention and the download 404'd on the creator's first real recording attempt. Two facts make
|
||||
the "pin is a const, just bump it" assumption wrong:
|
||||
**⛔ Why this was rewritten (2026-09-27 → shipped 2026-09-28).** The pinned-download design was a
|
||||
defect, not a cold-start edge case. It **failed in production on 2026-09-01** — the previous daily
|
||||
pin aged out of BtbN's 14-day retention and the download 404'd on the creator's first real recording
|
||||
attempt. Two facts made "the pin is a const, just bump it" wrong:
|
||||
- **Microsoft Store policy 10.2.2 forbids dynamic code inclusion.** Downloading an executable
|
||||
from the internet and running it is the exact pattern the policy names. An MSIX submission
|
||||
is rejected over it.
|
||||
- Bumping the pin is whack-a-mole against a retention window we do not control.
|
||||
|
||||
**Fix (TASK 48 item 1, recommended on EVERY route — it is not Store-conditional):** bundle
|
||||
`ffmpeg.exe` + `ffprobe.exe` + the `libav*.dll` family **inside the package**; `FfmpegLocator`
|
||||
resolves PATH → package-local → cache and never downloads. This also deletes the startup
|
||||
network dependency entirely. The LGPL-**shared** build choice is **unaffected** — dynamic
|
||||
linking was chosen for LGPL §6 compliance ("license text + source offer"), not to enable
|
||||
downloading. Analysis: `TASKS/research-store-certification.md` §4.
|
||||
Bundling deletes the startup network dependency entirely. The LGPL-**shared** build choice is
|
||||
**unaffected** — dynamic linking was chosen for LGPL §6 compliance ("license text + source offer"),
|
||||
not to enable downloading. Analysis: `TASKS/research-store-certification.md` §4.
|
||||
**Guardrail:** `FfmpegLocatorTests.TheLocatorCarriesNoNetworkCapability` asserts the locator's
|
||||
source contains no `HttpClient`/URL/downloader at all, so the policy cannot rot back.
|
||||
|
||||
**Every other third-party binary already ships via NuGet — ffmpeg was the only download-and-execute.**
|
||||
Verified 2026-09-28: `e_sqlite3.dll` and `WebView2Loader.dll` land in `runtimes\win-x64\native\`
|
||||
(SQLitePCLRaw + WebView2 packages) and NAudio/Notification.Wpf/Microsoft.Data.Sqlite/ProtectedData
|
||||
are managed. Two gaps remain and are **not** fixed by bundling: the **WebView2 Evergreen runtime** is
|
||||
a machine prerequisite (a manifest framework-dependency + graceful-failure path, TASK 48 item 2), and
|
||||
**Velopack's updater downloads and executes** — its teardown is a compliance action, not just cleanup.
|
||||
|
||||
|
||||
### Live encoder + RTMP push (TASK 4 ship step 3 — shipped 2026-08-12, plan in TASKS.md)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user