public IOPipeLine(Socket socket, RtmpServerOptions options, int resumeWriterThreshole = 65535) { _socket = socket; _resumeWriterThreshole = resumeWriterThreshole; _bufferProcessors = new Dictionary <ProcessState, BufferProcessor>(); Options = options; _handshakeContext = new HandshakeContext(this); }
public void Start() { server = new RtmpServerBuilder() .UseStartup <RtmpStartup>() .UseHarmonic(config => { options = config; }) .UseWebSocket(c => { c.BindEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 8080); }) .Build(); tokenSource = new CancellationTokenSource(); serverTask = server.StartAsync(tokenSource.Token); }
public async Task Stop() { using (serverTask) using (tokenSource) { try { tokenSource.Cancel(); await serverTask; } catch (Exception e) { } server = null; serverTask = null; tokenSource = null; options = null; publisherSessionService = null; } }