Esempio n. 1
0
		public VoicePacket Create(int seqNumber, int timeStamp, byte[] payload, int count)
		{
			VoicePacket packet;
			if (!_pool.TryPop(out packet))
			{
				packet = new VoicePacket(this);
			}
			packet.Init(seqNumber, timeStamp, payload, count);
			return packet;
		}
Esempio n. 2
0
        public VoicePacket Create(int seqNumber, int timeStamp, byte[] payload, int count)
        {
            VoicePacket packet;

            if (!_pool.TryPop(out packet))
            {
                packet = new VoicePacket(this);
            }
            packet.Init(seqNumber, timeStamp, payload, count);
            return(packet);
        }
Esempio n. 3
0
        private void Insert(VoicePacket packet)
        {
            if (!_reset)
            {
                var node = _buffer.First;
                while (node != null)
                {
                    if (packet.TimeStamp + _span <= _timestamp)
                    {
                        node.Value.Dispose();
                        _buffer.RemoveFirst();
                    }
                    node = node.Next;
                }
            }

            if (_lostCount > 20)
            {
                this.Reset();
            }

            if (_reset || packet.TimeStamp + _span >= _timestamp)
            {
                if (_buffer.Count == MaxBufferSize)
                {
                    _buffer.First.Value.Dispose();
                    _buffer.RemoveFirst();
                }
                var node = _buffer.First;
                while (node != null && node.Value.TimeStamp <= packet.TimeStamp)
                {
                    node = node.Next;
                }
                if (node == null)
                {
                    _buffer.AddLast(packet);
                }
                else
                {
                    _buffer.AddBefore(node, packet);
                }
            }
        }
Esempio n. 4
0
		private void Insert(VoicePacket packet)
		{
			if (!_reset)
			{
				var node = _buffer.First;
				while (node != null)
				{
					if (packet.TimeStamp + _span <= _timestamp)
					{
						node.Value.Dispose();
						_buffer.RemoveFirst();
					}
					node = node.Next;
				}
			}

			if (_lostCount > 20)
			{
				this.Reset();
			}

			if (_reset || packet.TimeStamp + _span >= _timestamp)
			{
				if (_buffer.Count == MaxBufferSize)
				{
					_buffer.First.Value.Dispose();
					_buffer.RemoveFirst();
				}
				var node = _buffer.First;
				while (node != null && node.Value.TimeStamp <= packet.TimeStamp)
				{
					node = node.Next;
				}
				if (node == null)
				{
					_buffer.AddLast(packet);
				}
				else
				{
					_buffer.AddBefore(node, packet);
				}
			}
		}
Esempio n. 5
0
 public void Recycle(VoicePacket packet)
 {
     _pool.Push(packet);
 }
Esempio n. 6
0
 public void Enqueue(VoicePacket packet)
 {
     _incoming.Enqueue(packet);
 }
Esempio n. 7
0
		public void Enqueue(VoicePacket packet)
		{
			_incoming.Enqueue(packet);
		}
Esempio n. 8
0
		public void Recycle(VoicePacket packet)
		{
			_pool.Push(packet);
		}