Esempio n. 1
0
 /// <summary>
 /// Construct a new voice session.
 /// </summary>
 /// <param name="codec">The transmit codec.</param>
 /// <param name="quality">The transmit quality (usually the sample rate).</param>
 /// <param name="client">An optional already-bound UDP client to use. If this is null, then a new client will be constructed.</param>
 /// <param name="transmitCallback">An optional callback to determine whether to transmit each packet. An application may
 /// use logic such as PTT (push-to-talk) or an automatic peak level-based approach. By default, all packets are transmitted.</param>
 public VoiceClient(CodecInfo codec, UdpClient client   = null,
                    TransmitPredicate transmitPredicate = null, ReceivePredicate receivePredicate = null)
     : base((byte)codec.PayloadType, codec.EncodedBufferSize, new IPEndPoint(new IPAddress(DummyIPAddress), DummyPort), client)
 {
     _peers            = new Dictionary <IPEndPoint, VoicePeer>();
     _pool             = new VoicePacketPool();
     _receivePredicate = receivePredicate;
     _voiceIn          = new VoiceIn(codec, this, transmitPredicate);
 }
Esempio n. 2
0
		/// <summary>
		/// Construct a new voice session.
		/// </summary>
		/// <param name="codec">The transmit codec.</param>
		/// <param name="quality">The transmit quality (usually the sample rate).</param>
		/// <param name="client">An optional already-bound UDP client to use. If this is null, then a new client will be constructed.</param>
		/// <param name="transmitCallback">An optional callback to determine whether to transmit each packet. An application may
		/// use logic such as PTT (push-to-talk) or an automatic peak level-based approach. By default, all packets are transmitted.</param>
		public VoiceClient(CodecInfo codec, UdpClient client = null,
			TransmitPredicate transmitPredicate = null, ReceivePredicate receivePredicate = null)
			: base((byte)codec.PayloadType, codec.EncodedBufferSize, new IPEndPoint(new IPAddress(DummyIPAddress), DummyPort), client)
		{
			_peers = new Dictionary<IPEndPoint, VoicePeer>();
			_pool = new VoicePacketPool();
			_receivePredicate = receivePredicate;
			_voiceIn = new VoiceIn(codec, this, transmitPredicate);
		}