Browse Source

fix segmenter semaphore (#1676)

* disable dead air watermarks by default

* fix session worker semaphore

* update changelog
pull/1677/head
Jason Dove 1 year ago committed by GitHub
parent
commit
8945a87f9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 18
      ErsatzTV.Application/Streaming/HlsSessionWorker.cs
  3. 10
      ErsatzTV.Application/Streaming/HlsSessionWorkerV2.cs
  4. 2
      ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs

2
CHANGELOG.md

@ -23,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -23,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Fix some cases of 404s from Plex when files were replaced and scanning the library from ETV didn't help
- Fix more wildcard search phrase queries (when wildcards are used in quotes, like `title:"law & order*"`)
- Fix bug where channels would unnecessarily wait on each other
- e.g. in-progress streams would delay responding with a playlist when new streams were starting
## [0.8.6-beta] - 2024-04-03
### Added

18
ErsatzTV.Application/Streaming/HlsSessionWorker.cs

@ -20,8 +20,8 @@ namespace ErsatzTV.Application.Streaming; @@ -20,8 +20,8 @@ namespace ErsatzTV.Application.Streaming;
public class HlsSessionWorker : IHlsSessionWorker
{
private static readonly SemaphoreSlim Slim = new(1, 1);
private static int _workAheadCount;
private readonly SemaphoreSlim _slim = new(1, 1);
private readonly IClient _client;
private readonly IConfigElementRepository _configElementRepository;
private readonly IHlsPlaylistFilter _hlsPlaylistFilter;
@ -66,14 +66,14 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -66,14 +66,14 @@ public class HlsSessionWorker : IHlsSessionWorker
{
_logger.LogInformation("API termination request for HLS session for channel {Channel}", _channelNumber);
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
await _cancellationTokenSource.CancelAsync();
}
finally
{
Slim.Release();
_slim.Release();
}
}
@ -97,7 +97,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -97,7 +97,7 @@ public class HlsSessionWorker : IHlsSessionWorker
try
{
var sw = Stopwatch.StartNew();
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken);
@ -117,7 +117,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -117,7 +117,7 @@ public class HlsSessionWorker : IHlsSessionWorker
}
finally
{
Slim.Release();
_slim.Release();
sw.Stop();
// _logger.LogDebug("TrimPlaylist took {Duration}", sw.Elapsed);
}
@ -535,7 +535,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -535,7 +535,7 @@ public class HlsSessionWorker : IHlsSessionWorker
private async Task TrimAndDelete(CancellationToken cancellationToken)
{
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
Option<string[]> maybeLines = await ReadPlaylistLines(cancellationToken);
@ -555,7 +555,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -555,7 +555,7 @@ public class HlsSessionWorker : IHlsSessionWorker
}
finally
{
Slim.Release();
_slim.Release();
}
}
@ -606,7 +606,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -606,7 +606,7 @@ public class HlsSessionWorker : IHlsSessionWorker
private async Task<long> GetPtsOffset(string channelNumber, CancellationToken cancellationToken)
{
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
long result = 0;
@ -635,7 +635,7 @@ public class HlsSessionWorker : IHlsSessionWorker @@ -635,7 +635,7 @@ public class HlsSessionWorker : IHlsSessionWorker
}
finally
{
Slim.Release();
_slim.Release();
}
}

10
ErsatzTV.Application/Streaming/HlsSessionWorkerV2.cs

@ -18,7 +18,7 @@ namespace ErsatzTV.Application.Streaming; @@ -18,7 +18,7 @@ namespace ErsatzTV.Application.Streaming;
public class HlsSessionWorkerV2 : IHlsSessionWorker
{
private static readonly SemaphoreSlim Slim = new(1, 1);
private readonly SemaphoreSlim _slim = new(1, 1);
//private static int _workAheadCount;
private readonly IConfigElementRepository _configElementRepository;
@ -65,14 +65,14 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker @@ -65,14 +65,14 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker
{
_logger.LogInformation("API termination request for HLS session for channel {Channel}", _channelNumber);
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
await _cancellationTokenSource.CancelAsync();
}
finally
{
Slim.Release();
_slim.Release();
}
}
@ -369,7 +369,7 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker @@ -369,7 +369,7 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker
private async Task<long> GetPtsOffset(string channelNumber, CancellationToken cancellationToken)
{
await Slim.WaitAsync(cancellationToken);
await _slim.WaitAsync(cancellationToken);
try
{
long result = 0;
@ -398,7 +398,7 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker @@ -398,7 +398,7 @@ public class HlsSessionWorkerV2 : IHlsSessionWorker
}
finally
{
Slim.Release();
_slim.Release();
}
}

2
ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs

@ -466,7 +466,7 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -466,7 +466,7 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
case CustomDeadAirFallback custom:
maybeFallback = new FillerPreset
{
AllowWatermarks = true,
AllowWatermarks = false, // TODO: does this need to be configurable?
CollectionType = custom.CollectionType,
CollectionId = custom.CollectionId,
MediaItemId = custom.MediaItemId,

Loading…
Cancel
Save