internal RemoteVoice(VoiceClient client, RemoteVoiceOptions options, int channelId, int playerId, byte voiceId, VoiceInfo info, byte lastEventNumber)
        {
            this.options      = options;
            this.voiceClient  = client;
            this.channelId    = channelId;
            this.playerId     = playerId;
            this.voiceId      = voiceId;
            this.Info         = info;
            this.lastEvNumber = lastEventNumber;
            if (this.options.Decoder == null) // init fields first for proper logging
            {
                voiceClient.transport.LogError(LogPrefix + ": decoder is null");
                disposed = true;
                return;
            }
#if NETFX_CORE
            ThreadPool.RunAsync((x) =>
            {
                decodeThread(this.options.Decoder);
            });
#else
            var t = new Thread(() => decodeThread(this.options.Decoder));
            t.Name = LogPrefix + " decode";
            t.Start();
#endif
        }
Example #2
0
        internal void onVoiceInfo(int channelId, int playerId, byte voiceId, byte eventNumber, VoiceInfo info)
        {
            Dictionary <byte, RemoteVoice> playerVoices = null;

            if (!remoteVoices.TryGetValue(playerId, out playerVoices))
            {
                playerVoices           = new Dictionary <byte, RemoteVoice>();
                remoteVoices[playerId] = playerVoices;
            }
            if (!playerVoices.ContainsKey(voiceId))
            {
                this.transport.LogInfo("[PV] ch#" + this.channelStr(channelId) + " p#" + this.playerStr(playerId) + " v#" + voiceId + " Info received: " + info.ToString() + " ev=" + eventNumber);
                RemoteVoiceOptions options = new RemoteVoiceOptions()
                {
                    OutputImageFormat = ImageFormat.Undefined, OutputImageFlip = Flip.Undefined
                };
                if (this.OnRemoteVoiceInfoAction != null)
                {
                    this.OnRemoteVoiceInfoAction(channelId, playerId, voiceId, info, ref options);
                }
                playerVoices[voiceId] = new RemoteVoice(this, options, channelId, playerId, voiceId, info, eventNumber);
            }
            else
            {
                if (!this.SuppressInfoDuplicateWarning)
                {
                    this.transport.LogWarning("[PV] Info duplicate for voice #" + voiceId + " of player " + this.playerStr(playerId) + " at channel " + this.channelStr(channelId));
                }
            }
        }
        private void onVoiceInfo(int channelId, int playerId, object payload)
        {
            Dictionary <int, Dictionary <byte, RemoteVoice> > channelVoices = null;

            if (!this.remoteVoices.TryGetValue(channelId, out channelVoices))
            {
                channelVoices = new Dictionary <int, Dictionary <byte, RemoteVoice> >();
                this.remoteVoices[channelId] = channelVoices;
            }
            Dictionary <byte, RemoteVoice> playerVoices = null;

            if (!channelVoices.TryGetValue(playerId, out playerVoices))
            {
                playerVoices            = new Dictionary <byte, RemoteVoice>();
                channelVoices[playerId] = playerVoices;
            }
            foreach (var el in (object[])payload)
            {
                var h       = (Dictionary <byte, Object>)el;
                var voiceId = (byte)h[(byte)EventParam.VoiceId];
                if (!playerVoices.ContainsKey(voiceId))
                {
                    var eventNumber = (byte)h[(byte)EventParam.EventNumber];
                    var info        = VoiceInfo.CreateFromEventPayload(h);
                    this.transport.LogInfo("[PV] ch#" + this.channelStr(channelId) + " p#" + this.playerStr(playerId) + " v#" + voiceId + " Info received: " + info.ToString() + " ev=" + eventNumber);
                    // create default decoder
                    RemoteVoiceOptions options = new RemoteVoiceOptions();
                    // create default decoder
                    // may be overwritten in OnRemoteVoiceInfoAction call
                    options.Decoder = VoiceCodec.CreateDefaultDecoder(channelId, playerId, voiceId, info, this.transport);
                    if (this.OnRemoteVoiceInfoAction != null)
                    {
                        this.OnRemoteVoiceInfoAction(channelId, playerId, voiceId, info, ref options);
                    }
                    playerVoices[voiceId] = new RemoteVoice(this, options, channelId, playerId, voiceId, info, eventNumber);
                }
                else
                {
                    if (!this.SuppressInfoDuplicateWarning)
                    {
                        this.transport.LogWarning("[PV] Info duplicate for voice #" + voiceId + " of player " + this.playerStr(playerId) + " at channel " + this.channelStr(channelId));
                    }
                }
            }
        }
        internal RemoteVoice(VoiceClient client, RemoteVoiceOptions options, int channelId, int playerId, byte voiceId, VoiceInfo info, byte lastEventNumber)
        {
            this.options      = options;
            this.voiceClient  = client;
            this.channelId    = channelId;
            this.playerId     = playerId;
            this.voiceId      = voiceId;
            this.Info         = info;
            this.lastEvNumber = lastEventNumber;
#if NETFX_CORE
            ThreadPool.RunAsync((x) =>
            {
                decodeThread();
            });
#else
            var t = new Thread(() => decodeThread());
            t.Name = LogPrefix + " decode";
            t.Start();
#endif
        }
        }                               // Dummy constructor

        internal RemoteVoice(VoiceClient client, RemoteVoiceOptions options, int channelId, int playerId, byte voiceId, VoiceInfo info, byte lastEventNumber)
        {
        }                                                                                                                                                                // 0x0000000180F26060-0x0000000180F262E0