public Task SendAsync(INanoPacket message)
        {
            switch (message.Header.PayloadType)
            {
            case NanoPayloadType.ChannelControl:
            case NanoPayloadType.ControlHandshake:
                return(SendAsyncControl(message));

            case NanoPayloadType.UDPHandshake:
                return(SendAsyncStreaming(message));

            case NanoPayloadType.Streamer:
                IStreamerMessage s = message as IStreamerMessage;
                if (s.StreamerHeader.PacketType == 4)
                {
                    return(SendAsyncStreaming(message));
                }
                else
                {
                    return(SendAsyncControl(message));
                }

            default:
                throw new NanoException(
                          "SendAsync: Unexpected PayloadType: {message.Header.PayloadType}");
            }
        }
        public void OnMessage(object sender, MessageReceivedEventArgs <INanoPacket> args)
        {
            IStreamerMessage packet = args.Message as IStreamerMessage;

            if (packet == null)
            {
                logger.LogTrace($"Not handling packet {args.Message.Header.PayloadType}");
                return;
            }

            switch ((VideoPayloadType)packet.StreamerHeader.PacketType)
            {
            case VideoPayloadType.Control:
                OnControl((VideoControl)packet);
                break;

            case VideoPayloadType.Data:
                OnData((VideoData)packet);
                break;
            }
        }
Example #3
0
        public void OnMessage(object sender, MessageReceivedEventArgs <INanoPacket> args)
        {
            IStreamerMessage packet = args.Message as IStreamerMessage;

            if (packet == null)
            {
                logger.LogTrace($"Not handling packet {args.Message.Header.PayloadType}");
                return;
            }

            switch ((InputPayloadType)packet.StreamerHeader.PacketType)
            {
            case InputPayloadType.Frame:
                OnFrame((InputFrame)packet);
                break;

            case InputPayloadType.FrameAck:
                OnFrameAck((InputFrameAck)packet);
                break;
            }
        }