Ejemplo n.º 1
0
        public int Decode(byte[] inData, int inOffset, int inCount, short[] outData, int outOffset, bool lostFrame)
        {
            if (this.decodedData.Length < outData.Length * 2)
            {
                this.decodedData = new float[outData.Length * 2];
            }
            if (lostFrame || inData == null)
            {
                this.decoder.Decode(null, this.decodedData);
                int i = 0;
                while (i < this.frameSize)
                {
                    outData[outOffset] = SpeexDecoder.ConvertToShort(this.decodedData[i]);
                    i++;
                    outOffset++;
                }
                return(this.frameSize);
            }
            this.bits.ReadFrom(inData, inOffset, inCount);
            int num = 0;

            while (this.decoder.Decode(this.bits, this.decodedData) == 0)
            {
                int j = 0;
                while (j < this.frameSize)
                {
                    outData[outOffset] = SpeexDecoder.ConvertToShort(this.decodedData[j]);
                    j++;
                    outOffset++;
                }
                num += this.frameSize;
            }
            return(num);
        }
Ejemplo n.º 2
0
 public SpeexJitterBuffer(SpeexDecoder decoder)
 {
     if (decoder == null)
     {
         throw new ArgumentNullException("decoder");
     }
     this.decoder                      = decoder;
     this.inPacket.sequence            = 0L;
     this.inPacket.span                = 1L;
     this.inPacket.timestamp           = 1L;
     this.buffer.DestroyBufferCallback = delegate(byte[] x)
     {
     };
     this.buffer.Init(1);
 }