CSharpRTMP.Core.Protocols.Rtsp.RtspProtocol.GetOutboundConnectivity C# (CSharp) Method

GetOutboundConnectivity() public method

public GetOutboundConnectivity ( IInNetStream pInNetStream, bool forceTcp ) : OutboundConnectivity
pInNetStream IInNetStream
forceTcp bool
return OutboundConnectivity
        public OutboundConnectivity GetOutboundConnectivity(IInNetStream pInNetStream, bool forceTcp)
        {
            if (OutboundConnectivity == null)
            {
                BaseOutNetRTPUDPStream pOutStream = new OutNetRTPUDPH264Stream(this,Application.StreamsManager,pInNetStream.Name, forceTcp);
                OutboundConnectivity = new OutboundConnectivity(forceTcp, this);
                if (!OutboundConnectivity.Initialize())
                {
                    FATAL("Unable to initialize outbound connectivity");
                    return null;
                }
                pOutStream.Connectivity = OutboundConnectivity;
                OutboundConnectivity.OutStream=pOutStream;

                if (!pInNetStream.Link(pOutStream))
                {
                    FATAL("Unable to link streams");
                    return null;
                }
            }

            return OutboundConnectivity;
        }
        public void CloseOutboundConnectivity() => OutboundConnectivity = null;

Usage Example

        private OutboundConnectivity GetOutboundConnectivity(RtspProtocol pFrom, bool forceTcp)
        {
            //1. Get the inbound stream
            var pInNetStream =
                    (IInNetStream)Application.StreamsManager.FindByUniqueId(
                    pFrom.CustomParameters["streamId"]);
            if (pInNetStream == null)
            {
                FATAL("Inbound stream {0} not found",pFrom.CustomParameters["streamId"]);
                return null;
            }

            //2. Get the outbound connectivity
            OutboundConnectivity pOutboundConnectivity = pFrom.GetOutboundConnectivity(pInNetStream, forceTcp);
                    
            if (pOutboundConnectivity == null)
            {
                FATAL("Unable to get the outbound connectivity");
                return null;
            }
            return pOutboundConnectivity;
        }