public static PayloadHandler Create(string RfcHandlerName) { PayloadHandler handler = null; switch (RfcHandlerName) { case "JPEG": handler = new RFC2435PayloadHandler(); break; case "MP4V-ES": handler = new RFC3016PayloadHandler(); break; case "H264": handler = new RFC3984PayloadHandler(); break; case "PCMU": handler = new RFC5391PayloadHandler(); break; default: //... break; } return(handler); }
public RTSPChannel(RTSPChannelParameters parameters) { Parameters = parameters; unicastUdpClient = new UnicastUdpClient(Parameters.RTPPort); rtpPacketHandler = new RtpPacketHandler(parameters.SSRT); unicastUdpClient.UdpPacketRecived += rtpPacketHandler.HandleRtpPacket; payloadHandler = PayloadHandlerFactory.Create(Parameters.Codec); rtpPacketHandler.RtpPacketRecieved += payloadHandler.HandleRtpPacket; payloadHandler.FrameReceived += PayloadHandler_FrameRecived; rtcpReporter = new RtcpReporter(Parameters.RTCPPort, Parameters.SampleRate); rtpPacketHandler.RtpPacketRecieved += rtcpReporter.HandleRtpPacket; rtcpReporter.RtpTimeReporting += videoRtcpClient_OnRtpTimeReporting; rtcpReporter.SessionTimeCorrecting += videoRtcpClient_OnRtpTimeCorrecting; }