Align decoder startup deadlines and deploy resilient 7.0.8

This commit is contained in:
2026-10-13 09:07:29 +02:00
parent 0a834d863b
commit 0ab790d1e4
10 changed files with 527 additions and 66 deletions
+33 -1
View File
@@ -50,6 +50,38 @@ public static class AdaptiveProbeTests
}
check(Deleted(snapshots), "successful adaptive probe deletes capture and snapshots");
snapshots.Clear(); attempts = 0;
var rejectedSampleStream = new ProbePacketStream(delay: 1);
using (var handler = new ProbeHttpHandler(rejectedSampleStream))
using (var client = new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
{
var probe = new LiveStreamProbe(client, (path, programme, extended, token) =>
{
snapshots.Add(path); attempts++;
if (!extended) throw new LiveStreamProbe.ProbeProcessException(1);
return Task.FromResult(Metadata(Sid, 1920));
}, limits, TimeSpan.FromSeconds(2));
check((await probe.Get("http://relay/channel", CancellationToken.None, Sid))[0].Width == 1920 && attempts == 2 && handler.Calls == 1,
"a first ffprobe sample rejection retries analysis on the same HTTP capture");
}
check(rejectedSampleStream.Disposed && Deleted(snapshots), "retried process rejection cleans up subscription and sample files");
snapshots.Clear(); attempts = 0;
var failedAnalysisStream = new ProbePacketStream(delay: 1);
using (var handler = new ProbeHttpHandler(failedAnalysisStream))
using (var client = new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
{
var probe = new LiveStreamProbe(client, (path, programme, extended, token) =>
{
snapshots.Add(path); attempts++;
throw new InvalidOperationException("Analysis implementation failed.");
}, limits, TimeSpan.FromSeconds(2));
var error = await Failure(probe.Get("http://relay/channel", CancellationToken.None, Sid));
check(attempts == 1 && handler.Calls == 1 && error.Contains("cause=probe_analysis_failure"),
"an unrelated first analysis failure is not retried");
}
check(failedAnalysisStream.Disposed && Deleted(snapshots), "unrelated analysis failure cleans up subscription and sample files");
snapshots.Clear(); attempts = 0;
var initiallyQuietStream = new ProbePacketStream(delay: 150);
using (var handler = new ProbeHttpHandler(initiallyQuietStream))
@@ -125,7 +157,7 @@ public static class AdaptiveProbeTests
finally { cancelledAnalysis = true; }
}, limits, TimeSpan.FromMilliseconds(180));
var error = await Failure(probe.Get("http://relay/channel", CancellationToken.None, Sid));
check(cancelledAnalysis && handler.Calls == 1 && analysingStream.Disposed && Deleted(snapshots) && error.Contains("cause=deadline"), "deadline cancels analysis, joins the reader and removes temporary files");
check(cancelledAnalysis && handler.Calls == 1 && snapshots.Count == 1 && analysingStream.Disposed && Deleted(snapshots) && error.Contains("cause=deadline"), "deadline cancels analysis without retry, joins the reader and removes temporary files");
}
}