예제 #1
0
        /// <summary>
        /// Send data (just valid for DataProducers created on a DirectTransport).
        /// </summary>
        /// <param name="message"></param>
        /// <param name="ppid"></param>
        /// <returns></returns>
        public Task SendAsync(string message, int?ppid)
        {
            _logger.LogDebug($"SendAsync() | DataProducer:{DataProducerId}");

            /*
             * +-------------------------------+----------+
             * | Value                         | SCTP     |
             * |                               | PPID     |
             * +-------------------------------+----------+
             * | WebRTC String                 | 51       |
             * | WebRTC Binary Partial         | 52       |
             * | (Deprecated)                  |          |
             * | WebRTC Binary                 | 53       |
             * | WebRTC String Partial         | 54       |
             * | (Deprecated)                  |          |
             * | WebRTC String Empty           | 56       |
             * | WebRTC Binary Empty           | 57       |
             * +-------------------------------+----------+
             */

            if (ppid == null)
            {
                ppid = !message.IsNullOrEmpty() ? 51 : 56;
            }

            // Ensure we honor PPIDs.
            if (ppid == 56)
            {
                message = " ";
            }

            var notifyData = new NotifyData {
                PPID = ppid.Value
            };

            _payloadChannel.Notify("dataProducer.send", _internal, notifyData, Encoding.UTF8.GetBytes(message));

            return(Task.CompletedTask);
        }
예제 #2
0
 public void SendRtcp(byte[] rtcpPacket)
 {
     PayloadChannel.Notify("transport.sendRtcp", Internal, null, rtcpPacket);
 }
예제 #3
0
 /// <summary>
 /// Send RTP packet (just valid for Producers created on a DirectTransport).
 /// </summary>
 /// <param name="rtpPacket"></param>
 public void Send(byte[] rtpPacket)
 {
     _payloadChannel.Notify("producer.send", _internal, null, rtpPacket);
 }