Esempio n. 1
0
        public MicEncoder(AudioEncodeCfg audioCfg, Action <MediaFrame> callback)
        {
            _audioCfg  = audioCfg;
            _channels  = audioCfg.Channel;
            _frequency = audioCfg.Frequency;
            _capturer  = new MicCapturer(audioCfg.MicId, _channels, _frequency, audioCfg.Samples, MicCapturer_CallBack);
            if (audioCfg.encodeName.EqIgnoreCase("SPEX"))
            {
                _speex = new Speex(4);
            }
            else if (audioCfg.encodeName.EqIgnoreCase("AAC_"))
            {
                if (audioCfg.Params.ContainsKey("UseLastFaacImp") && FaacImp.LastFaacImp != null)
                {
                    _faacImp = FaacImp.LastFaacImp;
                    _faacImp.Encode(new byte[2048]);
                    _faacImp.Encode(new byte[2048]);
                    _faacImp.Encode(new byte[2048]);
                    _faacImp.Encode(new byte[2048]);
                    _faacImp.Encode(new byte[2048]);
                }
                else
                {
                    _faacImp = new FaacImp(_channels, _frequency, audioCfg.Bitrate);
                }
            }

            _callBack = callback;
        }
Esempio n. 2
0
 private byte[] Enc_AAC(byte[] buffer)
 {
     return(_faacImp.Encode(buffer));
 }