fix: cap automatic playout refreshes

This commit is contained in:
2026-07-12 19:28:15 +09:00
parent 6e00955f1b
commit df60e09884
16 changed files with 603 additions and 37 deletions

View File

@@ -75,4 +75,13 @@ public sealed class PlayoutOptions
public int MaximumReconnectAttempts { get; set; } = 3;
public bool ReconnectEnabled { get; set; } = true;
/// <summary>
/// Optional trusted local safety ceiling for timer-driven same-scene refreshes
/// started by one TAKE IN. Null preserves the legacy continuous-refresh behavior;
/// zero disables automatic refresh; a positive value stops after that many
/// successful refresh dispatches and drains the final play callback before
/// reporting that the limit was reached. Web content cannot change this value.
/// </summary>
public int? MaximumAutomaticRefreshesPerTakeIn { get; set; }
}

View File

@@ -98,6 +98,14 @@ internal sealed record ValidatedPlayoutOptions(
0,
1_000,
nameof(options.MaximumReconnectAttempts));
if (options.MaximumAutomaticRefreshesPerTakeIn is { } maximumAutomaticRefreshes)
{
RequireRange(
maximumAutomaticRefreshes,
0,
1_000_000,
nameof(options.MaximumAutomaticRefreshesPerTakeIn));
}
Regex? titleRegex = null;
var allowlist = new HashSet<string>(StringComparer.OrdinalIgnoreCase);