Investigate MF activation — Vortice 3.6.2 API mismatch, defer port
Some checks failed
CI / build-and-test (push) Failing after 32s

Added Vortice.MediaFoundation 3.6.2 NuGet package to TeamsISO.Engine so the scaffold compiles when MF_AVAILABLE is defined. However: the scaffold (May 9) was written against an older Vortice surface and the 3.6.2 API has materially changed:

- MFVersion not on MediaFactory, MF_LOW_LATENCY moved

- IMFAttributes.SetUINT32 replaced with generic Set

- IMFMediaType.MajorType / SubType / AvgBitrate property setters → SetGUID(MFAttributeKeys.MajorType, ...) etc.

- VideoFormatGuids.RGB32 renamed (likely Rgb32)

- IMFMediaBuffer.Lock signature changed (explicit out IntPtr / out int / out int)

- IMFSinkWriter.Finalize_ renamed

Leaving MF_AVAILABLE undefined for now so the build stays clean. NuGet ref stays so a porter doesn't need to re-add. docs/REAL-TIME-RECORDING.md updated with the deferred status + the specific API gaps to port.
This commit is contained in:
Zac Gaetano 2026-05-10 20:39:23 -04:00
parent d8186c5eb8
commit 8e08d7dc6a
2 changed files with 37 additions and 6 deletions

View file

@ -14,15 +14,36 @@ It's behind a build flag because activating it requires adding a NuGet
dependency. The structural code is already in
`src/TeamsISO.Engine/Pipeline/MediaFoundationRecorderSink.cs`.
## Activating it
## Status — May 2026
1. **Add the NuGet dependency** to the engine project:
**Activation deferred.** The Vortice.MediaFoundation 3.6.2 NuGet package
is referenced from `TeamsISO.Engine.csproj`, but the `MF_AVAILABLE` symbol
is *not* defined. The scaffold in
`src/TeamsISO.Engine/Pipeline/MediaFoundationRecorderSink.cs` was written
against an older Vortice API and needs a port pass before activation:
dotnet add src/TeamsISO.Engine package Vortice.MediaFoundation --version 3.6.2
- `MFVersion` → not on `MediaFactory` in 3.6.2; pass the SDK version
directly to `MFStartup`.
- `MediaFactory.MF_LOW_LATENCY` → relocated to a different attribute
constants class.
- `IMFAttributes.SetUINT32` → replaced with a generic `Set` overload.
- `IMFMediaType.MajorType` / `.SubType` / `.AvgBitrate` properties
→ now use `SetGUID(MFAttributeKeys.MajorType, ...)` etc.
- `VideoFormatGuids.RGB32` → renamed (likely `Rgb32`).
- `IMFMediaBuffer.Lock(out IntPtr, out int, out int)` → explicit out-param
signature, no longer returns a locked-buffer wrapper.
- `IMFSinkWriter.Finalize_` → renamed (likely `Finalize`).
(Pin to a known-good version — Vortice's API surface is stable across
3.6.x but the engine code targets the namespaces in 3.6.x. If a newer
major version changes namespaces, the file may need adjustment.)
Until the port lands, the `RawBgraRecorderSink` is the only IRecorderSink
production uses. The raw recorder is reliable and FFmpeg post-processing
via the emitted `convert.cmd` produces equivalent .mp4s; you just pay the
disk pressure during the show.
## Activating it (after the port)
1. **Update the scaffold** to match Vortice 3.6.2's API surface. A clean
reference implementation lives in the Vortice samples repo under
`samples/MediaFoundationSamples`.
2. **Define the `MF_AVAILABLE` build symbol** in `TeamsISO.Engine.csproj`:

View file

@ -2,6 +2,15 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<!-- MediaFoundationRecorderSink is gated on MF_AVAILABLE — DON'T define
it yet. The Vortice.MediaFoundation 3.6.2 API has materially changed
from what the scaffold assumed (MFVersion / MF_LOW_LATENCY moved,
IMFMediaType lost MajorType / SubType / AvgBitrate property setters,
IMFMediaBuffer.Lock signature changed, Finalize_ renamed, etc.) so
turning it on at the source level today won't compile. Tracked as
a known issue in docs/REAL-TIME-RECORDING.md — when the scaffold is
rewritten against the 3.6.2 surface, re-add the define here. -->
<!-- <DefineConstants>$(DefineConstants);MF_AVAILABLE</DefineConstants> -->
</PropertyGroup>
<ItemGroup>
@ -11,6 +20,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="Vortice.MediaFoundation" Version="3.6.2" />
</ItemGroup>
<ItemGroup>