private HLSChannelSink(HTTPLiveStreamingDirectOwinApp owner, OwinEnvironment ctx, Tuple <Channel, string> session) { this.owner = owner; this.session = session; connectionInfo.AgentName = ctx.Request.Headers.Get("User-Agent"); connectionInfo.LocalDirects = null; connectionInfo.LocalRelays = null; connectionInfo.ProtocolName = "HLS Direct"; connectionInfo.RecvRate = null; connectionInfo.SendRate = null; connectionInfo.ContentPosition = 0; var remoteEndPoint = new IPEndPoint(IPAddress.Parse(ctx.Request.RemoteIpAddress), ctx.Request.RemotePort ?? 0); connectionInfo.RemoteEndPoint = remoteEndPoint; connectionInfo.RemoteName = remoteEndPoint.ToString(); connectionInfo.RemoteSessionID = null; connectionInfo.RemoteHostStatus = RemoteHostStatus.Receiving; if (remoteEndPoint.Address.GetAddressLocality() < 2) { connectionInfo.RemoteHostStatus |= RemoteHostStatus.Local; } connectionInfo.Status = ConnectionStatus.Connected; connectionInfo.Type = ConnectionType.Direct; getRecvRate = ctx.Get <Func <float> >(OwinEnvironment.PeerCastStation.GetRecvRate); getSendRate = ctx.Get <Func <float> >(OwinEnvironment.PeerCastStation.GetSendRate); contentSink = HLSContentSink.GetSubscription(owner, Channel); }
public ChannelSink(OwinEnvironment ctx) { connectionInfo.AgentName = ctx.Request.Headers.Get("User-Agent"); connectionInfo.LocalDirects = null; connectionInfo.LocalRelays = null; connectionInfo.ProtocolName = "HTTP Direct"; connectionInfo.RecvRate = null; connectionInfo.SendRate = null; connectionInfo.ContentPosition = 0; var remoteEndPoint = new IPEndPoint(IPAddress.Parse(ctx.Request.RemoteIpAddress), ctx.Request.RemotePort ?? 0); connectionInfo.RemoteEndPoint = remoteEndPoint; connectionInfo.RemoteName = remoteEndPoint.ToString(); connectionInfo.RemoteSessionID = null; connectionInfo.RemoteHostStatus = RemoteHostStatus.Receiving; if (remoteEndPoint.Address.GetAddressLocality()<2) { connectionInfo.RemoteHostStatus |= RemoteHostStatus.Local; } connectionInfo.Status = ConnectionStatus.Connected; connectionInfo.Type = ConnectionType.Direct; getRecvRate = ctx.Get<Func<float>>(OwinEnvironment.PeerCastStation.GetRecvRate); getSendRate = ctx.Get<Func<float>>(OwinEnvironment.PeerCastStation.GetSendRate); }
private HLSChannelSink AddRef(OwinEnvironment ctx) { connectionInfo.AgentName = ctx.Request.Headers.Get("User-Agent"); var remoteEndPoint = new IPEndPoint(IPAddress.Parse(ctx.Request.RemoteIpAddress), ctx.Request.RemotePort ?? 0); connectionInfo.RemoteEndPoint = remoteEndPoint; connectionInfo.RemoteName = remoteEndPoint.ToString(); if (remoteEndPoint.Address.GetAddressLocality() < 2) { connectionInfo.RemoteHostStatus |= RemoteHostStatus.Local; } else { connectionInfo.RemoteHostStatus &= ~RemoteHostStatus.Local; } getRecvRate = ctx.Get <Func <float> >(OwinEnvironment.PeerCastStation.GetRecvRate); getSendRate = ctx.Get <Func <float> >(OwinEnvironment.PeerCastStation.GetSendRate); if (Interlocked.Increment(ref referenceCount) == 1 && subscription == null) { Interlocked.Exchange(ref subscription, Channel.AddOutputStream(this))?.Dispose(); } return(this); }