Пример #1
0
 internal LocalVoiceVideo(VoiceClient voiceClient, IEncoder encoder, byte id, VoiceInfo voiceInfo, int channelId) : base(voiceClient, encoder, id, voiceInfo, channelId)
 {
     if (this.encoder == null)
     {
         this.encoder = VoiceCodec.CreateDefaultEncoder(voiceInfo, this);
     }
 }
Пример #2
0
        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.frontend.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);
                    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.frontend.LogWarning("[PV] Info duplicate for voice #" + voiceId + " of player " + this.playerStr(playerId) + " at channel " + this.channelStr(channelId));
                    }
                }
            }
        }