fix(history): file each session under the real encoder, not "unknown"
FfmpegEncoder resolved the encoder name into its OWN StreamHealth instance, while the view model read CurrentHealth — a different object. So every recorded session was filed as "unknown", and the rate history's encoder key (evidence about NVENC says nothing about QSV) had nothing to key on. The name now travels on the encoder interface and the pump forwards it: IFfmpegEncoder.VideoEncoderName -> FramePump.EncoderName. Caught while adding it: reading _framePump.EncoderName from RefreshRateProposal throws, because that call runs at MainViewModel ctor line 354 and the pump is built at line 468. Eight tests failed with the same NullReferenceException, which took a while to see because the harness's test output is buffered — the first honest look at per-test logging named it in one line. Guarded; the history falls back to the last session's encoder for that tier, which is exactly the pre-first-session case the fallback already existed for. Tests: FramePumpTests gains the encoder-name assertion (null before start, h264_nvenc after), and the three fake encoders implement the new member. 675 pass, 0 warnings.
This commit is contained in:
@@ -145,7 +145,10 @@ public partial class MainViewModel
|
||||
// Before this run's first stream the encoder is unknown; the last session on this tier is
|
||||
// the honest guess, and evidence about a different encoder stays out either way.
|
||||
var lastForTier = history.LastOrDefault(entry => entry.Tier == tier.Display);
|
||||
var encoder = CurrentHealth.VideoEncoder
|
||||
// The pump is built later in the constructor than this runs, so before the first session
|
||||
// there is no encoder to ask; the last session on this tier is the honest guess, and
|
||||
// evidence about a different encoder stays out either way.
|
||||
var encoder = (_framePump is { } pump ? pump.EncoderName : null)
|
||||
?? (string.IsNullOrEmpty(lastForTier.Encoder) ? null : lastForTier.Encoder);
|
||||
|
||||
var suggestion = RateHistory.Suggest(history, tier.Display, encoder, RatedMbps);
|
||||
|
||||
@@ -57,7 +57,7 @@ public partial class MainViewModel
|
||||
{
|
||||
_layoutStore.AppendRateHistory(new SessionRateResult(
|
||||
SelectedQuality.Display,
|
||||
CurrentHealth.VideoEncoder ?? "unknown",
|
||||
_framePump.EncoderName ?? "unknown",
|
||||
_sessionRatedMbps,
|
||||
planner.Current.BitrateMbps,
|
||||
planner.Policy.StepsUsed));
|
||||
|
||||
Reference in New Issue
Block a user