From cb43c28d00f7bff43048c6dea60b9a55b30985fc Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Tue, 29 Aug 2023 05:01:13 -0500 Subject: [PATCH] fix hls session when starting with very short content (#1400) --- ErsatzTV.Application/Streaming/HlsSessionWorker.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ErsatzTV.Application/Streaming/HlsSessionWorker.cs b/ErsatzTV.Application/Streaming/HlsSessionWorker.cs index 263b01b2f..130e8d35e 100644 --- a/ErsatzTV.Application/Streaming/HlsSessionWorker.cs +++ b/ErsatzTV.Application/Streaming/HlsSessionWorker.cs @@ -236,7 +236,14 @@ public class HlsSessionWorker : IHlsSessionWorker { _workAheadState = HlsSessionWorkAheadState.SeekAndRealtime; } - + + // this happens when we initially transcode (at max speed) insufficient content to work + // in realtime yet, so we need to reset to max speed + if (!realtime && _workAheadState is not HlsSessionWorkAheadState.MaxSpeed) + { + _workAheadState = HlsSessionWorkAheadState.MaxSpeed; + } + _logger.LogInformation("Work ahead state: {State}", _workAheadState); DateTimeOffset now = (_firstProcess || _workAheadState is HlsSessionWorkAheadState.MaxSpeed)