From d336c8aaa922d6373e9ece38f37c5506511e7eac Mon Sep 17 00:00:00 2001 From: Kieran Date: Sat, 29 Jul 2023 22:11:34 +0100 Subject: [PATCH] Abort thumbnail generation after 10s --- NostrStreamer/Services/ThumbnailService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NostrStreamer/Services/ThumbnailService.cs b/NostrStreamer/Services/ThumbnailService.cs index 5bf06b6..6170735 100644 --- a/NostrStreamer/Services/ThumbnailService.cs +++ b/NostrStreamer/Services/ThumbnailService.cs @@ -26,7 +26,8 @@ public class ThumbnailService { var cmd = FFMpegArguments .FromUrlInput(new Uri(_config.RtmpHost, $"{stream.Endpoint.App}/source/{stream.User.StreamKey}?vhost=hls.zap.stream")) - .OutputToFile(path, true, o => { o.ForceFormat("image2").WithCustomArgument("-vframes 1"); }); + .OutputToFile(path, true, o => { o.ForceFormat("image2").WithCustomArgument("-vframes 1"); }) + .CancellableThrough(new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token); _logger.LogInformation("Running command {cmd}", cmd.Arguments); await cmd.ProcessAsynchronously();