// 以视频发起方初始化 public void InitVideoAsRequest(String tgtNeck, int thisSendPort, int thisRecvPort, VideoMirror.OnFrameReceivedHandler onFRH) { foreach (VideoMirror vs in videoList) { if (tgtNeck == vs.OtherNeck) { throw new Exception(String.Format("视频连接重复!已经存在一个和{0}之间的视频回话", tgtNeck)); } } VideoMirror newSource = new VideoMirror(tgtNeck); newSource.thisSendEP = new IPEndPoint(ChaitClient.Instance.LocalIP, thisSendPort); newSource.thisRecvEP = new IPEndPoint(ChaitClient.Instance.LocalIP, thisRecvPort); newSource.OnFrameReceivedEvent += onFRH; videoList.Add(newSource); }
// 以视频接收方初始化 public void InitVideoAsResponse(String otherNeck, int thisSendPort, int thisRecvPort, IPAddress otherIP, int otherSendPort, int otherRecvPort, VideoMirror.OnFrameReceivedHandler srcEP) { foreach (VideoMirror vr in videoList) { if (otherNeck == vr.OtherNeck) { throw new Exception("视频连接重复!"); } } VideoMirror newTarget = new VideoMirror(otherNeck); newTarget.thisSendEP = new IPEndPoint(ChaitClient.Instance.LocalIP, thisSendPort); newTarget.thisRecvEP = new IPEndPoint(ChaitClient.Instance.LocalIP, thisRecvPort); newTarget.otherSendEP = new IPEndPoint(otherIP, otherSendPort); newTarget.otherRecvEP = new IPEndPoint(otherIP, otherRecvPort); newTarget.OnFrameReceivedEvent += srcEP; videoList.Add(newTarget); }