/// <summary> /// Sends specified RTCP packet to the session remote party. /// </summary> /// <param name="packet">RTCP compound packet.</param> /// <returns>Returns packet size in bytes.</returns> /// <exception cref="ObjectDisposedException">Is raised when this class is Disposed and this method is accessed.</exception> /// <exception cref="ArgumentNullException">Is raised when <b>packet</b> is null reference.</exception> internal int SendRtcpPacket(RTCP_CompoundPacket packet) { if(m_IsDisposed){ throw new ObjectDisposedException(this.GetType().Name); } if(packet == null){ throw new ArgumentNullException("packet"); } byte[] packetBytes = packet.ToByte(); // Send packet to each remote target. foreach(RTP_Address target in this.Targets){ try{ m_pRtcpSocket.SendTo(packetBytes,packetBytes.Length,SocketFlags.None,target.RtcpEP); m_RtcpPacketsSent++; m_RtcpBytesSent += packetBytes.Length; // RFC requires IP header counted too, we just don't do it. m_RtcpAvgPacketSize = (1/16) * packetBytes.Length + (15/16) * m_RtcpAvgPacketSize; } catch{ m_RtcpFailedTransmissions++; } } return packetBytes.Length; }