feat: enhance routing and messaging logic with improved source handling and batch processing capabilities

This commit is contained in:
Neil Dorin 2026-06-24 20:10:52 -06:00
parent a732c5e08e
commit f4fe8eff90
10 changed files with 214 additions and 76 deletions

View file

@ -74,14 +74,17 @@ public class GenericAudioOut : EssentialsDevice, IRoutingSinkWithFeedback
continue;
}
if (!signalType.HasFlag(type))
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
var previousSource = CurrentSources[type];
CurrentSources.TryGetValue(type, out var previousSource);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, previousSource, sourceDevice);
}
UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
@ -99,11 +102,11 @@ public class GenericAudioOut : EssentialsDevice, IRoutingSinkWithFeedback
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceDevice.Key;
CurrentSourceKeys[signalType] = sourceDevice?.Key;
}
else
{
CurrentSourceKeys.Add(signalType, sourceDevice.Key);
CurrentSourceKeys.Add(signalType, sourceDevice?.Key);
}
// Raise the CurrentSourcesChanged event

View file

@ -373,14 +373,17 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
continue;
}
if (!signalType.HasFlag(type))
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
var previousSource = CurrentSources[type];
CurrentSources.TryGetValue(type, out var previousSource);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, previousSource, sourceDevice);
}
UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
@ -398,11 +401,11 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceDevice.Key;
CurrentSourceKeys[signalType] = sourceDevice?.Key;
}
else
{
CurrentSourceKeys.Add(signalType, sourceDevice.Key);
CurrentSourceKeys.Add(signalType, sourceDevice?.Key);
}
// Raise the CurrentSourcesChanged event

View file

@ -63,14 +63,17 @@ public class GenericSink : EssentialsDevice, IRoutingSinkWithFeedback
continue;
}
if (!signalType.HasFlag(type))
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
var previousSource = CurrentSources[type];
CurrentSources.TryGetValue(type, out var previousSource);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, previousSource, sourceDevice);
}
UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
@ -88,11 +91,11 @@ public class GenericSink : EssentialsDevice, IRoutingSinkWithFeedback
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceDevice.Key;
CurrentSourceKeys[signalType] = sourceDevice?.Key;
}
else
{
CurrentSourceKeys.Add(signalType, sourceDevice.Key);
CurrentSourceKeys.Add(signalType, sourceDevice?.Key);
}
// Raise the CurrentSourcesChanged event

View file

@ -93,14 +93,17 @@ public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSinkWithFeedback
continue;
}
if (!signalType.HasFlag(type))
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
var previousSource = CurrentSources[type];
CurrentSources.TryGetValue(type, out var previousSource);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, previousSource, sourceDevice);
}
UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
@ -118,11 +121,11 @@ public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSinkWithFeedback
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceDevice.Key;
CurrentSourceKeys[signalType] = sourceDevice?.Key;
}
else
{
CurrentSourceKeys.Add(signalType, sourceDevice.Key);
CurrentSourceKeys.Add(signalType, sourceDevice?.Key);
}
// Raise the CurrentSourcesChanged event

View file

@ -100,14 +100,17 @@ public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWi
continue;
}
if (!signalType.HasFlag(type))
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
var previousSource = CurrentSources[type];
CurrentSources.TryGetValue(type, out var previousSource);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, previousSource, sourceDevice);
}
UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
@ -125,11 +128,11 @@ public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWi
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceDevice.Key;
CurrentSourceKeys[signalType] = sourceDevice?.Key;
}
else
{
CurrentSourceKeys.Add(signalType, sourceDevice.Key);
CurrentSourceKeys.Add(signalType, sourceDevice?.Key);
}
// Raise the CurrentSourcesChanged event