Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/PepperDash.Essentials.Core/Routing/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static (RouteDescriptor, RouteDescriptor) GetRouteToSource(this IRoutingI
}
// otherwise, audioVideo needs to be handled as two steps.

Debug.LogDebug(destination, "Attempting to build source route from {destinationKey} to {sourceKey} of type {type}", source.Key, signalType);
Debug.LogDebug(destination, "Attempting to build source route from {destinationKey} to {sourceKey} of type {type}", destination.Key, source.Key, signalType);

RouteDescriptor audioRouteDescriptor;

Expand Down Expand Up @@ -374,24 +374,28 @@ public static void MapDestinationsToSources()
IndexTieLines();
}

var sinks = DeviceManager.AllDevices.OfType<IRoutingInputs>().Where(d => !(d is IRoutingInputsOutputs));
var sources = DeviceManager.AllDevices.OfType<IRoutingOutputs>().Where(d => !(d is IRoutingInputsOutputs));
var sinks = DeviceManager.AllDevices.OfType<IRoutingInputs>();
var sources = DeviceManager.AllDevices.OfType<IRoutingOutputs>();

foreach (var sink in sinks)
foreach (var sink in sinks.Where(d => !(d is IRoutingInputsOutputs)))
{
foreach (var source in sources)
foreach (var source in sources.Where(d => !(d is IRoutingInputsOutputs)))
{
foreach (var inputPort in sink.InputPorts)
{
foreach (var outputPort in source.OutputPorts)
{
var (audioOrSingleRoute, videoRoute) = sink.GetRouteToSource(source, inputPort.Type, inputPort, outputPort);
var (audioOrSingleRoute, videoRoute) = sink.GetRouteToSource(source, outputPort.Type, inputPort, outputPort);

if (audioOrSingleRoute == null && videoRoute == null)
{
continue;
}

Debug.LogVerbose("AudioOrSingleRoute Found: {audioRoute}", audioOrSingleRoute);

Debug.LogVerbose("VideoRoute Found: {videoRoute}", videoRoute);

Comment thread
ndorin marked this conversation as resolved.
if (audioOrSingleRoute != null)
{
// Only add routes that have actual switching steps
Expand Down Expand Up @@ -646,6 +650,8 @@ private static bool GetRouteToSource(this IRoutingInputs destination, IRoutingOu
// Only the ones that are routing devices
var midpointTieLines = destinationTieLines.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);

Debug.LogVerbose(destination, "Found {tieLineCount} tie lines to walk for {destinationKey}", midpointTieLines.Count(), destination.Key);
Comment thread
ndorin marked this conversation as resolved.

//Create a list for tracking already checked devices to avoid loops, if it doesn't already exist from previous iteration
if (alreadyCheckedDevices == null)
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
Expand Down Expand Up @@ -685,7 +691,7 @@ private static bool GetRouteToSource(this IRoutingInputs destination, IRoutingOu

if (goodInputPort == null)
{
Debug.LogVerbose(destination, "No route found to {0}", source.Key);
Debug.LogVerbose(destination, "No route found to {0} from destination {1} for type {2}", source.Key, destination.Key, signalType);

// Cache this as an impossible route
_impossibleRoutes.TryAdd(routeKey, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ private void BuildMidpointSinkMap()

foreach (var midpointKey in upstreamMidpoints)
{
if (string.IsNullOrEmpty(midpointKey))
continue;

if (!midpointToSinksMap.ContainsKey(midpointKey))
midpointToSinksMap[midpointKey] = new HashSet<string>();

Expand Down Expand Up @@ -115,7 +118,8 @@ private void TraceUpstreamMidpoints(TieLine tieLine, HashSet<string> midpoints,

if (tieLine.SourcePort.ParentDevice is IRoutingWithFeedback midpoint)
{
midpoints.Add(midpoint.Key);
if (!string.IsNullOrEmpty(midpoint.Key))
midpoints.Add(midpoint.Key);

// Find upstream TieLines connected to this midpoint's inputs
var midpointInputs = (midpoint as IRoutingInputs)?.InputPorts;
Expand Down Expand Up @@ -244,6 +248,9 @@ private void RebuildMapForSink(IRoutingSinkWithSwitchingWithInputPort sink)
var upstreamMidpoints = GetUpstreamMidpoints(sink);
foreach (var midpointKey in upstreamMidpoints)
{
if (string.IsNullOrEmpty(midpointKey))
continue;

if (!midpointToSinksMap.ContainsKey(midpointKey))
midpointToSinksMap[midpointKey] = new HashSet<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <summary>
/// Represents a MockVC
/// </summary>
public class MockVC : VideoCodecBase, IRoutingSource, IHasCallHistory, IHasScheduleAwareness, IHasCallFavorites, IHasDirectory, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets
public class MockVC : VideoCodecBase, IRoutingSource, IHasCallHistory, IHasScheduleAwareness, IHasCallFavorites, IHasDirectory, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IRoutingInputs
{
/// <summary>
/// Gets or sets the PropertiesConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <summary>
/// Base class for video codec devices
/// </summary>
public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingInputsOutputs,
public abstract class VideoCodecBase : ReconfigurableDevice,
IUsageTracking, IHasDialer, IHasContentSharing, ICodecAudio, iVideoCodecInfo, IBridgeAdvanced, IHasStandbyMode
Comment thread
ndorin marked this conversation as resolved.
{
private const int XSigEncoding = 28591;
Expand Down
Loading