public static StudioConnectionDto ToDto(this IStudioConnection studioConnection) { return(new StudioConnectionDto { Id = studioConnection.Id, State = studioConnection.State, InputComponentId = studioConnection.Input?.Component.Id ?? -1, InputId = studioConnection.Input?.Id ?? -1, OutputComponentId = studioConnection.Output?.Component.Id ?? -1, OutputId = studioConnection.Output?.Id ?? -1 }); }
public void RemoveConnection(IStudioConnection connection) { if (!_connections.Contains(connection)) { return; } connection.SetTargetState(Shared.ConnectionState.Destroyed); _connections.Remove(connection); ConnectionRemoved?.Invoke(this, connection); }
public void Removes_connection() { var virtualStudio = new VirtualStudio(); var placeholder = new PlaceholderStudioComponent(); virtualStudio.ComponentRepository.AddPlaceholder(placeholder); var component = virtualStudio.AddComponent(placeholder) as PlaceholderStudioComponent; var input = component.AddInput("input", DataKind.Audio, "ConnectionType"); var output = component.AddOutput("output", DataKind.Audio, "ConnectionType"); IStudioConnection connection = virtualStudio.CreateConnection(output, input); virtualStudio.RemoveConnection(connection); Assert.IsTrue(virtualStudio.Connections.Count == 0); }
public void Init() { virtualStudio = new VirtualStudio(); var placeholder = new PlaceholderStudioComponent(); placeholder.AddInput("Input 1", DataKind.Audio, "UDP"); virtualStudio.ComponentRepository.AddPlaceholder(placeholder); componentWithUdpAudioInput = virtualStudio.AddComponent(placeholder); placeholder = new PlaceholderStudioComponent(); placeholder.AddOutput("Output 1", DataKind.Audio, "UDP"); virtualStudio.ComponentRepository.AddPlaceholder(placeholder); componentWithUdpAudioOutput = virtualStudio.AddComponent(placeholder); connection = virtualStudio.CreateConnection(componentWithUdpAudioOutput.Outputs[0], componentWithUdpAudioInput.Inputs[0]); }
public void Adds_connection_between_endpoints_that_exist_in_components() { var virtualStudio = new VirtualStudio(); var placeholder = new PlaceholderStudioComponent(); virtualStudio.ComponentRepository.AddPlaceholder(placeholder); var component = virtualStudio.AddComponent(placeholder) as PlaceholderStudioComponent; var input = component.AddInput("input", DataKind.Audio, "ConnectionType"); var output = component.AddOutput("output", DataKind.Audio, "ConnectionType"); Assert.IsTrue(virtualStudio.CanCreateConnection(output, input)); IStudioConnection connection = virtualStudio.CreateConnection(output, input); Assert.IsNotNull(connection); Assert.IsTrue(virtualStudio.Connections.Count == 1); }
public WebRtcConnectProcess(IStudioConnection connection) { Connection = connection ?? throw new ArgumentNullException(nameof(connection)); }
private void VirtualStudio_ConnectionRemoved(object sender, IStudioConnection connection) { connection.StateChanged -= Connection_StateChanged; operationHandler.RemoveConnection(VirtualStudioName, connection.Id); }
private void VirtualStudio_ConnectionAdded(object sender, IStudioConnection connection) { connection.StateChanged += Connection_StateChanged; operationHandler.CreateConnection(VirtualStudioName, connection.ToDto()); }