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/).
- Optimize graphics engine to generate element frames in parallel and to eliminate redundant frame copies - 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 - Match graphics engine framerate with source content (or channel normalized) framerate
- Fix loading requested number of epg entries for motion graphics elements - 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 ### Changed
- No longer round framerate to nearest integer when normalizing framerate - 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;
namespace ErsatzTV.Application.Streaming; namespace ErsatzTV.Application.Streaming;
public record PlayoutItemProcessModel( public class PlayoutItemProcessModel
Command Process, {
Option<GraphicsEngineContext> GraphicsEngineContext, public PlayoutItemProcessModel(
Option<TimeSpan> MaybeDuration, Command process,
DateTimeOffset Until, Option<GraphicsEngineContext> graphicsEngineContext,
bool IsComplete, Option<TimeSpan> maybeDuration,
Option<long> SegmentKey, DateTimeOffset until,
Option<int> MediaItemId); 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
DateTimeOffset.MaxValue, DateTimeOffset.MaxValue,
true, true,
Option<long>.None, 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(
string ffprobePath, string ffprobePath,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
DateTimeOffset now = DateTimeOffset.Now;
Command process = await ffmpegProcessService.ForError( Command process = await ffmpegProcessService.ForError(
ffmpegPath, ffmpegPath,
channel, channel,
now, request.Now,
request.MaybeDuration, request.MaybeDuration,
request.ErrorMessage, request.ErrorMessage,
request.HlsRealtime, request.HlsRealtime,
@ -42,7 +40,8 @@ public class GetErrorProcessHandler(
request.MaybeDuration, request.MaybeDuration,
request.Until, request.Until,
true, true,
now.ToUnixTimeSeconds(), request.Now.ToUnixTimeSeconds(),
Option<int>.None); Option<int>.None,
Optional(channel.PlayoutOffset));
} }
} }

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

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

Loading…
Cancel
Save