Browse Source

fix mirror channels (#2697)

pull/2698/head
Jason Dove 4 weeks ago committed by GitHub
parent
commit
9c23b03758
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 55
      ErsatzTV.Application/Streaming/PlayoutItemProcessModel.cs
  3. 3
      ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs
  4. 9
      ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs
  5. 17
      ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs
  6. 3
      ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs

1
CHANGELOG.md

@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Optimize graphics engine to generate element frames in parallel and to eliminate redundant frame copies
- Match graphics engine framerate with source content (or channel normalized) framerate
- Fix loading requested number of epg entries for motion graphics elements
- Fix bug with mirror channels where seemingly random content would be played every ~40 seconds
### Changed
- No longer round framerate to nearest integer when normalizing framerate

55
ErsatzTV.Application/Streaming/PlayoutItemProcessModel.cs

@ -3,11 +3,50 @@ using ErsatzTV.Core.Interfaces.Streaming; @@ -3,11 +3,50 @@ using ErsatzTV.Core.Interfaces.Streaming;
namespace ErsatzTV.Application.Streaming;
public record PlayoutItemProcessModel(
Command Process,
Option<GraphicsEngineContext> GraphicsEngineContext,
Option<TimeSpan> MaybeDuration,
DateTimeOffset Until,
bool IsComplete,
Option<long> SegmentKey,
Option<int> MediaItemId);
public class PlayoutItemProcessModel
{
public PlayoutItemProcessModel(
Command process,
Option<GraphicsEngineContext> graphicsEngineContext,
Option<TimeSpan> maybeDuration,
DateTimeOffset until,
bool isComplete,
Option<long> segmentKey,
Option<int> mediaItemId,
Option<TimeSpan> playoutOffset)
{
Process = process;
GraphicsEngineContext = graphicsEngineContext;
MaybeDuration = maybeDuration;
Until = until;
IsComplete = isComplete;
SegmentKey = segmentKey;
MediaItemId = mediaItemId;
// undo the offset applied in FFmpegProcessHandler
// so we don't continually walk backward/forward in time by the offset amount
foreach (TimeSpan offset in playoutOffset)
{
foreach (long key in SegmentKey)
{
SegmentKey = key + (long)offset.TotalSeconds;
}
Until += offset;
}
}
public Command Process { get; init; }
public Option<GraphicsEngineContext> GraphicsEngineContext { get; init; }
public Option<TimeSpan> MaybeDuration { get; init; }
public DateTimeOffset Until { get; init; }
public bool IsComplete { get; init; }
public Option<long> SegmentKey { get; init; }
public Option<int> MediaItemId { get; init; }
}

3
ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs

@ -45,6 +45,7 @@ public class GetConcatProcessByChannelNumberHandler : FFmpegProcessHandler<GetCo @@ -45,6 +45,7 @@ public class GetConcatProcessByChannelNumberHandler : FFmpegProcessHandler<GetCo
DateTimeOffset.MaxValue,
true,
Option<long>.None,
Option<int>.None);
Option<int>.None,
Option<TimeSpan>.None);
}
}

9
ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs

@ -21,12 +21,10 @@ public class GetErrorProcessHandler( @@ -21,12 +21,10 @@ public class GetErrorProcessHandler(
string ffprobePath,
CancellationToken cancellationToken)
{
DateTimeOffset now = DateTimeOffset.Now;
Command process = await ffmpegProcessService.ForError(
ffmpegPath,
channel,
now,
request.Now,
request.MaybeDuration,
request.ErrorMessage,
request.HlsRealtime,
@ -42,7 +40,8 @@ public class GetErrorProcessHandler( @@ -42,7 +40,8 @@ public class GetErrorProcessHandler(
request.MaybeDuration,
request.Until,
true,
now.ToUnixTimeSeconds(),
Option<int>.None);
request.Now.ToUnixTimeSeconds(),
Option<int>.None,
Optional(channel.PlayoutOffset));
}
}

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

@ -332,8 +332,9 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -332,8 +332,9 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
duration,
finish,
true,
now.ToUnixTimeSeconds(),
Option<int>.None);
effectiveNow.ToUnixTimeSeconds(),
Option<int>.None,
Optional(channel.PlayoutOffset));
}
MediaVersion version = playoutItemWithPath.PlayoutItem.MediaItem.GetHeadVersion();
@ -463,7 +464,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -463,7 +464,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
finish,
isComplete,
effectiveNow.ToUnixTimeSeconds(),
playoutItemResult.MediaItemId);
playoutItemResult.MediaItemId,
Optional(channel.PlayoutOffset));
return Right<BaseError, PlayoutItemProcessModel>(result);
}
@ -519,7 +521,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -519,7 +521,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
finish,
true,
now.ToUnixTimeSeconds(),
Option<int>.None);
Option<int>.None,
Optional(channel.PlayoutOffset));
case PlayoutItemDoesNotExistOnDisk:
Command doesNotExistProcess = await _ffmpegProcessService.ForError(
ffmpegPath,
@ -541,7 +544,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -541,7 +544,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
finish,
true,
now.ToUnixTimeSeconds(),
Option<int>.None);
Option<int>.None,
Optional(channel.PlayoutOffset));
default:
Command errorProcess = await _ffmpegProcessService.ForError(
ffmpegPath,
@ -563,7 +567,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -563,7 +567,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
finish,
true,
now.ToUnixTimeSeconds(),
Option<int>.None);
Option<int>.None,
Optional(channel.PlayoutOffset));
}
}

3
ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs

@ -47,6 +47,7 @@ public class GetWrappedProcessByChannelNumberHandler : FFmpegProcessHandler<GetW @@ -47,6 +47,7 @@ public class GetWrappedProcessByChannelNumberHandler : FFmpegProcessHandler<GetW
DateTimeOffset.MaxValue,
true,
Option<long>.None,
Option<int>.None);
Option<int>.None,
Option<TimeSpan>.None);
}
}

Loading…
Cancel
Save