예제 #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;
		}
예제 #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);
        }
예제 #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);
                }
            }
        }
예제 #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);
				}
			}
		}
예제 #5
0
 public void Recycle(VoicePacket packet)
 {
     _pool.Push(packet);
 }
예제 #6
0
 public void Enqueue(VoicePacket packet)
 {
     _incoming.Enqueue(packet);
 }
예제 #7
0
		public void Enqueue(VoicePacket packet)
		{
			_incoming.Enqueue(packet);
		}
예제 #8
0
		public void Recycle(VoicePacket packet)
		{
			_pool.Push(packet);
		}