Esempio n. 1
0
        /// <summary>
        /// Encodes a frame.
        /// </summary>
        /// <param name="frame">The frame.</param>
        /// <returns></returns>
        public override byte[] Encode(AudioBuffer frame)
        {
            if (_Encoder == null)
            {
                _Encoder = new Encoder(ClockRate, Channels, PacketTime);
                _Encoder.Quality = 1.0;
                _Encoder.Bitrate = 125;
            }

            byte[] data; int index; int length;
            var echoCanceller = EchoCanceller;
            if (echoCanceller == null)
            {
                data = frame.Data;
                index = frame.Index;
                length = frame.Length;
            }
            else
            {
                data = echoCanceller.capture(frame);
                index = 0;
                length = data.Length;
            }

            return _Encoder.Encode(data, index, length);
        }
Esempio n. 2
0
        /// <summary>
        /// Destroys the codec.
        /// </summary>
        public override void Destroy()
        {
            if (_Encoder != null)
            {
                _Encoder.Destroy();
                _Encoder = null;
            }

            if (_Decoder != null)
            {
                _Decoder.Destroy();
                _Decoder = null;
            }
        }