GetInboundConnectivity() public method

public GetInboundConnectivity ( string sdpStreamName, uint bandwidthHint, byte rtcpDetectionInterval ) : InboundConnectivity
sdpStreamName string
bandwidthHint uint
rtcpDetectionInterval byte
return InboundConnectivity
        private bool HandleRTSPRequestAnnounce(RtspProtocol pFrom, Variant requestHeaders, string requestContent)
        {
            //1. Make sure we ONLY handle application/sdp
            if ((string)requestHeaders[RTSP_HEADERS,RTSP_HEADERS_CONTENT_TYPE]!= RTSP_HEADERS_ACCEPT_APPLICATIONSDP)
            {
                FATAL("Invalid ANNOUNCE request:\n{0}", (requestHeaders.ToString()));
                return false;
            }

            //2. Get the SDP
            var sdp = pFrom.InboundSDP;

            //3. Parse the SDP
            if (!SDP.ParseSDP(sdp, requestContent))
            {
                FATAL("Unable to parse the SDP");
                return false;
            }

            //4. Get the first video track
            var videoTrack = sdp.GetVideoTrack(0,requestHeaders[RTSP_FIRST_LINE,RTSP_URL]);
                    
            var audioTrack = sdp.GetAudioTrack(0,requestHeaders[RTSP_FIRST_LINE,RTSP_URL]);
                    

            //5. Store the tracks inside the session for later use
            if (audioTrack != VariantType.Null)
            {
                pFrom.CustomParameters["pendingTracks",audioTrack["globalTrackIndex"]] = audioTrack;
            }
            if (videoTrack != VariantType.Null)
            {
                pFrom.CustomParameters["pendingTracks",videoTrack["globalTrackIndex"]] = videoTrack;
            }

            //6. Mark this connection as inbound connection
            pFrom.CustomParameters["isInbound"] = true;

            //7. Save the streamName
            string streamName = sdp.GetStreamName();
            if (streamName == "")
            {
                streamName = $"rtsp_stream_{pFrom.Id}";
            }
            pFrom.CustomParameters["sdpStreamName"] = streamName;
            streamName = new Uri(requestHeaders[RTSP_FIRST_LINE, RTSP_URL],UriKind.Absolute).Segments.Last();
            //8. Save the bandwidth hint
            pFrom.CustomParameters["sdpBandwidthHint"] = sdp.GetTotalBandwidth();

            //9. Get the inbound connectivity
            InboundConnectivity pInboundConnectivity = pFrom.GetInboundConnectivity(
                    streamName,
                    sdp.GetTotalBandwidth(),Application.Configuration[CONF_APPLICATION_RTCPDETECTIONINTERVAL]);
            if (pInboundConnectivity == null)
            {
                FATAL("Unable to create inbound connectivity");
                return false;
            }

            //8. Send back the response
            pFrom.PushResponseFirstLine(RTSP_VERSION_1_0, 200, "OK");
            return pFrom.SendResponseMessage();
        }
 private bool HandleRTSPResponse200Describe(RtspProtocol rtspProtocol, Variant requestHeaders, ref string requestContent, Variant responseHeaders, ref string responseContent)
 {
     //1. Make sure we ONLY handle application/sdp
     if (responseHeaders[RTSP_HEADERS, RTSP_HEADERS_CONTENT_TYPE] == null)
     {
         FATAL("Invalid DESCRIBE response:\n{0}", (requestHeaders.ToString()));
         return false;
     }
     if (responseHeaders[RTSP_HEADERS, RTSP_HEADERS_CONTENT_TYPE] == RTSP_HEADERS_ACCEPT_APPLICATIONSDP)
     {
         FATAL("Invalid DESCRIBE response:\n{0}", (requestHeaders.ToString()));
         return false;
     }
     //2. Get the SDP
     var sdp = rtspProtocol.InboundSDP;
     //3. Parse the SDP
     if (!SDP.ParseSDP(sdp, responseContent))
     {
         FATAL("Unable to parse the SDP");
         return false;
     }
     //4. Get the first video track
     var videoTrack = sdp.GetVideoTrack(0,requestHeaders[RTSP_FIRST_LINE,RTSP_URL]);
     var audioTrack = sdp.GetAudioTrack(0,requestHeaders[RTSP_FIRST_LINE,RTSP_URL]);
     if ((videoTrack == VariantType.Null) && (audioTrack == VariantType.Null))
     {
         FATAL("No compatible tracks found");
         return false;
     }
     var forceTcp = rtspProtocol.CustomParameters["forceTcp"];
     var rtcpDetectionInterval = Application.Configuration[CONF_APPLICATION_RTCPDETECTIONINTERVAL];
     if (rtspProtocol.CustomParameters[CONF_APPLICATION_RTCPDETECTIONINTERVAL]!=null)
         rtcpDetectionInterval = (byte)rtspProtocol.CustomParameters[CONF_APPLICATION_RTCPDETECTIONINTERVAL];
     //5. Store the tracks inside the session for later use
     if (audioTrack != VariantType.Null)
     {
         audioTrack["isTcp"] = (bool)forceTcp;
         rtspProtocol.CustomParameters["pendingTracks"][(int)audioTrack["globalTrackIndex"]] = audioTrack;
     }
     if (videoTrack != VariantType.Null)
     {
         videoTrack["isTcp"] = (bool)forceTcp;
         rtspProtocol.CustomParameters["pendingTracks"][(int)videoTrack["globalTrackIndex"]] = videoTrack;
     }
     //6. Save the streamName
     string streamName = sdp.GetStreamName();
     if (streamName == "")
     {
         streamName = "rtsp_stream_"+rtspProtocol.Id;
     }
     rtspProtocol.CustomParameters["sdpStreamName"] = streamName;
     //7. Save the bandwidth hint
     rtspProtocol.CustomParameters["sdpBandwidthHint"] = sdp.GetTotalBandwidth();
     //8. Get the inbound connectivity
     var pInboundConnectivity = rtspProtocol.GetInboundConnectivity(streamName, sdp.GetTotalBandwidth(),
         rtcpDetectionInterval);
     if (pInboundConnectivity == null)
     {
         FATAL("Unable to create inbound connectivity");
         return false;
     }
     //9. Start sending the setup commands on the pending tracks;
     return SendSetupTrackMessages(rtspProtocol);
 }