From 6d152e4b4a456c25bc0b3f0062d7c45221d8bdd9 Mon Sep 17 00:00:00 2001
From: Jason Dove <1695733+jasongdove@users.noreply.github.com>
Date: Sat, 7 Jun 2025 15:45:07 -0500
Subject: [PATCH] use more accurate BANDWIDTH value in multi-variant playlist
(#2023)
---
CHANGELOG.md | 1 +
ErsatzTV.Application/Channels/Mapper.cs | 3 +++
.../Channels/Queries/GetChannelResolution.cs | 3 ---
.../Queries/GetChannelResolutionAndBitrate.cs | 3 +++
...r.cs => GetChannelResolutionAndBitrateHandler.cs} | 12 +++++++-----
.../Channels/ResolutionAndBitrateViewModel.cs | 3 +++
ErsatzTV/Controllers/IptvController.cs | 9 ++++++---
7 files changed, 23 insertions(+), 11 deletions(-)
delete mode 100644 ErsatzTV.Application/Channels/Queries/GetChannelResolution.cs
create mode 100644 ErsatzTV.Application/Channels/Queries/GetChannelResolutionAndBitrate.cs
rename ErsatzTV.Application/Channels/Queries/{GetChannelResolutionHandler.cs => GetChannelResolutionAndBitrateHandler.cs} (54%)
create mode 100644 ErsatzTV.Application/Channels/ResolutionAndBitrateViewModel.cs
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c504efe2..3187d3b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix playout detail table to only reload once when resetting a playout
- Fix date formatting in playout detail table on reload (will now respect browser's `Accept-Language` header)
- Use cache busting to avoid UI errors after upgrading the MudBlazor library
+- Fix multi-variant playlist to report more accurate `BANDWIDTH` value based on ffmpeg profile
## [25.1.0] - 2025-01-10
### Added
diff --git a/ErsatzTV.Application/Channels/Mapper.cs b/ErsatzTV.Application/Channels/Mapper.cs
index ff4a611c..a64bb9ca 100644
--- a/ErsatzTV.Application/Channels/Mapper.cs
+++ b/ErsatzTV.Application/Channels/Mapper.cs
@@ -39,6 +39,9 @@ internal static class Mapper
internal static ResolutionViewModel ProjectToViewModel(Resolution resolution) =>
new(resolution.Height, resolution.Width);
+ internal static ResolutionAndBitrateViewModel ProjectToViewModel(Resolution resolution, int bitrate) =>
+ new(resolution.Height, resolution.Width, bitrate);
+
private static string GetLogo(Channel channel) =>
Optional(channel.Artwork.FirstOrDefault(a => a.ArtworkKind == ArtworkKind.Logo))
.Match(a => a.Path, string.Empty);
diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelResolution.cs b/ErsatzTV.Application/Channels/Queries/GetChannelResolution.cs
deleted file mode 100644
index 46b7d887..00000000
--- a/ErsatzTV.Application/Channels/Queries/GetChannelResolution.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace ErsatzTV.Application.Channels;
-
-public record GetChannelResolution(string ChannelNumber) : IRequest