Browse Source

limit framerate normalization to 24fps and above (#662)

pull/664/head
Jason Dove 3 years ago committed by GitHub
parent
commit
572a3be33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 15
      ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs

4
CHANGELOG.md

@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix watermark on scaled and/or padded video with NVIDIA acceleration
- Fix playback of interlaced mpeg2video content with NVIDIA acceleration
### Changed
- Framerate normalization will never normalize framerate below 24fps
- Instead, content with a lower framerate will be normalized up to 24fps
## [0.4.2-alpha] - 2022-02-26
### Fixed
- Add improved but experimental transcoder logic, which can be toggled on and off in `Settings`

15
ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs

@ -31,7 +31,7 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O @@ -31,7 +31,7 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O
{
// TODO: expand to check everything in collection rather than what's scheduled?
_logger.LogDebug("Checking frame rates for channel {ChannelNumber}", request.ChannelNumber);
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
List<Playout> playouts = await dbContext.Playouts
@ -58,12 +58,23 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O @@ -58,12 +58,23 @@ public class GetChannelFramerateHandler : IRequestHandler<GetChannelFramerate, O
.Map(mv => mv.RFrameRate)
.ToList();
var distinct = frameRates.Distinct().ToList();
if (distinct.Count > 1)
{
// TODO: something more intelligent than minimum framerate?
int result = frameRates.Map(ParseFrameRate).Min();
if (result < 24)
{
_logger.LogInformation(
"Normalizing frame rate for channel {ChannelNumber} from {Distinct} to {FrameRate} instead of min value {MinFrameRate}",
request.ChannelNumber,
distinct,
24,
result);
return 24;
}
_logger.LogInformation(
"Normalizing frame rate for channel {ChannelNumber} from {Distinct} to {FrameRate}",
request.ChannelNumber,

Loading…
Cancel
Save