diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-09-28 23:52:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-28 23:52:34 +0900 |
| commit | 7030e925b77ec1091680e2044b7a5b843ebae9fa (patch) | |
| tree | f8375b68cf9a9349bd338d6d82ee9c7d2d9bdbf3 | |
| parent | 206c382b92d8139efbe18da8786b46f9aa2e632e (diff) | |
| parent | 3fa3a9d57a9e1d8ab0ae34443731a74aceed9563 (diff) | |
Merge pull request #4200 from ryanpetris/hdhomerun-preemptive-livetv-conflict
HDHomeRun: Preemptively throw a LiveTvConflictException
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 28e30fac8..2f4c60117 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -563,6 +563,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun protected override async Task<ILiveStream> GetChannelStream(TunerHostInfo info, ChannelInfo channelInfo, string streamId, List<ILiveStream> currentLiveStreams, CancellationToken cancellationToken) { + var tunerCount = info.TunerCount; + + if (tunerCount > 0) + { + var tunerHostId = info.Id; + var liveStreams = currentLiveStreams.Where(i => string.Equals(i.TunerHostId, tunerHostId, StringComparison.OrdinalIgnoreCase)); + + if (liveStreams.Count() >= tunerCount) + { + throw new LiveTvConflictException("HDHomeRun simultaneous stream limit has been reached."); + } + } + var profile = streamId.Split('_')[0]; Logger.LogInformation("GetChannelStream: channel id: {0}. stream id: {1} profile: {2}", channelInfo.Id, streamId, profile); |
