feat(server): route renders by settings format and adapted size; gate older servers

Owner review 1, phase 4 (P5). A render job now carries the output size its
settings give (RenderSize, proportions win) and the settings format it needs,
resolved on the server before the job is split, so only nodes that read that
format and whose encoder takes the frame claim it, and a job no online node
can read no longer waits for one. Nodes and the server announce the format
they read; settings of a newer Chronos fail saying so.

Encoder size limits are read as long edge x short edge: Media Foundation's
software H.264 encoder, announced as 4096x2304, accepts portrait 2160x3840
(probed on this PC), so EncoderSelector and the provider take either
orientation and cap a portrait frame against the turned limit.

On the desktop, Sync and Send-and-render are disabled with the
NeedsNewerServer tooltip while the server reads an older format than the
working settings need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 19:48:23 +01:00
1 parent e4364c4f25
commit fca6c8dfea
27 files changed
+663 -47

No files matched your search

@@ -551,10 +551,17 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public bool CanRender => RenderBlockedReason is null;
/// <summary>The settings format a render of <see cref="RenderExport"/> needs (<see cref="Chronos.Data.Processing.ProcessingJobs.RequiredFormat"/>).</summary>
private int RenderFormat =>
Chronos.Data.Processing.ProcessingJobs.RequiredFormat(Session.Project, RenderExport, Session.Content.SourceWidth, Session.Content.SourceHeight);
/// <summary>Why the project's export cannot be rendered now, localised; null when it can.</summary>
public string? RenderBlockedReason => Plan switch
{
_ when IsRemote && !Shell.Services.Sync.CanRender => Loc.L("Tooltips.Editor.Render.NoRight", ServerName),
// Settings or proportions the server would render otherwise (owner review 1, phase 4: an older server, Send and render too).
_ when IsRemote && ServerJobs.NeedsNewerServer(RenderFormat, Shell.Services.Sync.SettingsFormat)
is { } newer => newer,
_ when IsOutdated => Loc.L("Tooltips.Editor.Outdated", ServerName),
null when _planned => Loc.L("Tooltips.Editor.Render.NoSource"),
null => Loc.L("Tooltips.Editor.Render.Planning"),
+7
View File
@@ -56,6 +56,13 @@ internal sealed class ServerJobs : IAsyncDisposable
/// <summary>The connection the jobs travel on (the source's other calls use it too).</summary>
public IRemoteSequenceApi Api { get; }
/// <summary>
/// Why something that needs settings format <paramref name="required"/> cannot go to a server that reads
/// <paramref name="serverFormat"/> (owner review 1, phase 4: a render, a push, Send and render); null when it can. The
/// desktop disables the action with this as its tooltip.
/// </summary>
public static string? NeedsNewerServer(int required, int serverFormat) => required > serverFormat ? Loc.L("Tooltips.Server.NeedsNewerServer") : null;
/// <summary>Queues <paramref name="request"/> on the server (its priority set after, when it is not the user's); returns the job id.</summary>
/// <exception cref="EditorException">The sequence is gone from the server.</exception>
public async Task<Guid> SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken)
+1 -1
View File
@@ -118,7 +118,7 @@
<ContextMenu>
<MenuItem Header="{l:Loc Editor.Project.SaveVersion}" Command="{Binding Project.SaveVersionCommand}" InputGestureText="Ctrl+S"
ToolTip="{Binding Project.SaveVersionToolTip}" ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Editor.Project.Sync}" Command="{Binding Project.SyncCommand}" ToolTip="{Binding Project.StateToolTip}" ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Editor.Project.Sync}" Command="{Binding Project.SyncCommand}" ToolTip="{Binding Project.SyncToolTip}" ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Editor.Project.History}" Command="{Binding Project.HistoryCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.History}" />
<Separator />
<MenuItem Header="{l:Loc Editor.Project.Open}" Command="{Binding Project.OpenProjectCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.Open}" />
+11 -1
View File
@@ -81,6 +81,16 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
public bool HasProjects =>
services.Server.IsConnected && services.Server.Flow.Info?.Capabilities is { } capabilities && capabilities.Contains(ServerCapabilities.Projects);
/// <summary>
/// The highest project settings format the signed-in server reads and renders (owner review 1, phase 4); 1 while signed
/// out and for an older server, which does not announce it. Pushes and renders that need more are held back
/// (<see cref="ServerJobs.NeedsNewerServer"/>).
/// </summary>
public int SettingsFormat => SettingsFormatOf(services.Server.IsConnected ? services.Server.Flow.Info : null);
/// <summary>The settings format a server's <c>server/info</c> announces; 1 when it announces none (an older server).</summary>
public static int SettingsFormatOf(ServerInfo? info) => info?.SettingsFormat is > 0 and var format ? format : ProjectSettings.BaseVersion;
/// <summary>The home of a workspace project of server sequence <paramref name="remoteId"/>; null while signed out or when the server keeps no projects.</summary>
public BundleHome? ServerHome(Guid remoteId) => Server is { } server && HasProjects ? new BundleHome(BundleHome.ServerKind, remoteId, null, server) : null;
@@ -95,7 +105,7 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
if (home.IsArchive || !HasProjects || Volatile.Read(ref _credentials) is not { } credentials
|| !string.Equals(home.Server, SyncService.ServerKey(credentials.Address), StringComparison.OrdinalIgnoreCase))
return null;
return new ServerProjectHome(SessionClient(credentials), home.SequenceId, services.Server.ServerName);
return new ServerProjectHome(SessionClient(credentials), home.SequenceId, services.Server.ServerName, SettingsFormat);
}
/// <summary>
@@ -108,7 +108,7 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
_source = source;
_session = session;
_ui = ui;
_sync = new AsyncRelayCommand(() => SyncAsync(), () => !_isSyncing);
_sync = new AsyncRelayCommand(() => SyncAsync(), () => !_isSyncing && PushBlockedReason is null);
_updateMedia = new AsyncRelayCommand(UpdateMediaAsync, () => _copyJob == Guid.Empty);
SaveVersionCommand = new RelayCommand(OpenSaveVersion, () => CanSaveVersion);
HistoryCommand = new AsyncRelayCommand(OpenHistoryAsync);
@@ -146,6 +146,18 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
public string StateToolTip => WorkspaceText.StateToolTip(_status, _isSyncing, IsServerHome);
/// <summary>
/// Why the project cannot be sent to its server now (owner review 1, phase 4): its settings are of a format the server
/// does not read (an older Chronos Server, which would refuse them); null when they can, and for a project of this PC's
/// archive. Sync is disabled with this as its tooltip, and a render of the server's is held.
/// </summary>
public string? PushBlockedReason => IsServerHome && _source.Workspace is { } workspace && _host.HomeOf(workspace.Home) is { } home
? ServerJobs.NeedsNewerServer(_session.Project.WrittenFormat, home.SettingsFormat)
: null;
/// <summary>Sync in the menu: why it is disabled, else where the project stands.</summary>
public string SyncToolTip => PushBlockedReason ?? StateToolTip;
/// <summary>The ▾ button: its name, then where the project stands, then what the menu holds.</summary>
public string MenuToolTip => Loc.L("Tooltips.Editor.Project.Menu", Name, StateText);
@@ -270,6 +282,12 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
if (_host.Settings.WorkspaceVersionOnRender && !await SaveForRenderAsync()) return false;
// Rendered on this PC from the originals the workspace holds (phase 5c): the project renders as it is.
if (!IsServerHome || _source.RendersLocally) return true;
// Settings the server cannot read are neither sent nor rendered there (owner review 1, phase 4: an older server).
if (PushBlockedReason is { } newer)
{
_ui.Notify(Loc.L("Editor.Workspace.RenderHeld"), newer, isError: true);
return false;
}
await StoreEditAsync();
var status = await _host.StatusAsync(ProjectId);
if (_disposed) return false;
@@ -386,6 +404,12 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
public async Task SyncAsync(bool quiet = false)
{
if (_isSyncing) return;
// Settings the server cannot read stay here until it is updated (owner review 1, phase 4): Sync says why.
if (PushBlockedReason is { } newer)
{
if (!quiet) _ui.Notify(Loc.L("Editor.Workspace.NotSent"), newer, isError: true);
return;
}
SetSyncing(true);
try
{
@@ -1026,6 +1050,8 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
OnPropertyChanged(nameof(StateText));
OnPropertyChanged(nameof(StateKind));
OnPropertyChanged(nameof(StateToolTip));
OnPropertyChanged(nameof(PushBlockedReason));
OnPropertyChanged(nameof(SyncToolTip));
OnPropertyChanged(nameof(MenuToolTip));
OnPropertyChanged(nameof(MenuName));
OnPropertyChanged(nameof(HasMediaUpdate));
@@ -1044,6 +1070,7 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
OnPropertyChanged(nameof(CopyOriginalsToolTip));
OnPropertyChanged(nameof(ProxiesOnlyToolTip));
_updateMedia.RaiseCanExecuteChanged();
_sync.RaiseCanExecuteChanged();
CommandManager.InvalidateRequerySuggested();
}
}