CSharpRTMP.Core.Protocols.Rtsp.RtspProtocol.SendRaw C# (CSharp) Méthode

SendRaw() public méthode

public SendRaw ( MsgHdr message, RTPClient &client, bool isAudio, bool isData ) : bool
message MsgHdr
client RTPClient
isAudio bool
isData bool
Résultat bool
        public bool SendRaw(MsgHdr message,ref RTPClient client,bool isAudio,bool isData)
        {
            OutputBuffer.WriteByte((byte) '$');
            if (isAudio)
            {
                OutputBuffer.WriteByte(isData ? client.audioDataChannel : client.audioRtcpChannel);
            }
            else
            {
                OutputBuffer.WriteByte(isData ? client.videoDataChannel : client.videoRtcpChannel);
            }
            OutputBuffer.Write((ushort)message.Buffers.Sum(x=>x.Length));
            foreach (var buffer in message.Buffers)
            {
                OutputBuffer.WriteBytes(buffer);
            }
            return EnqueueForOutbound(OutputBuffer);
        }

Same methods

RtspProtocol::SendRaw ( byte buffer ) : bool

Usage Example

        public bool SendRR(bool isAudio)
        {
            if (_forceTcp)
            {
                return(true);
            }

            /*
             *          0                   1                   2                   3
             *          0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             * header |V=2|P|    RC   |   PT=RR=201   |             length            |0
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                     SSRC of packet sender                     |4
             +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
             | report |                 SSRC_1 (SSRC of first source)                 |8
             | block  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             | 1    | fraction lost |       cumulative number of packets lost       |12
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |           extended highest sequence number received           |16
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                      interarrival jitter                      |20
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                         last SR (LSR)                         |24
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                   delay since last SR (DLSR)                  |28
             +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             | header |V=2|P|    SC   |  PT=SDES=202  |             length            |
             +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
             | chunk  |                          SSRC/CSRC_1                          |
             | 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                           SDES items                          |
             |                              ...                              |
             +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
             | chunk  |                          SSRC/CSRC_2                          |
             | 2    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |                           SDES items                          |
             |                              ...                              |
             +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
             */
            var rtp    = isAudio ? _rtpAudio : _rtpVideo;
            var rtcp   = isAudio ? _rtcpAudio : _rtcpVideo;
            var buffer = isAudio ? _audioRR : _videoRR;

            //1. prepare the buffer
            buffer.Write(12, rtp.SSRC);              //SSRC_1 (SSRC of first source)
            buffer.Write(20, rtp.ExtendedSeq);       //extended highest sequence number received
            buffer.Write(28, rtcp.LastSenderReport); //last SR (LSR)
            if (_forceTcp)
            {
                return(_rtsp.SendRaw(buffer));
            }
            else
            {
                if (rtcp.LastAddress != null)
                {
                    if (rtcp.IOHandler.Socket.SendTo(buffer, 4, 56, SocketFlags.None, rtcp.LastAddress) != 56)
                    {
                        FATAL("Unable to send data");
                        return(false);
                    }
                }
                else
                {
                    //WARN("Skip this RR because we don't have a valid address yet");
                }
                return(true);
            }
        }
All Usage Examples Of CSharpRTMP.Core.Protocols.Rtsp.RtspProtocol::SendRaw