Ejemplo n.º 1
0
        // Token: 0x0600015B RID: 347 RVA: 0x00004648 File Offset: 0x00002848
        public unsafe static void OpusEncode(IntPtr encoder, ReadOnlySpan <byte> pcm, int frameSize, ref Span <byte> opus)
        {
            int num;

            fixed(byte *pinnableReference = pcm.GetPinnableReference())
            {
                byte *pcmData = pinnableReference;

                fixed(byte *pinnableReference2 = opus.GetPinnableReference())
                {
                    byte *data = pinnableReference2;

                    num = Interop._OpusEncode(encoder, pcmData, frameSize, data, opus.Length);
                }
            }

            if (num < 0)
            {
                OpusError opusError = (OpusError)num;
                throw new Exception(string.Format("Could not encode PCM data to Opus: {0} ({1}).", opusError, (int)opusError));
            }
            opus = opus.Slice(0, num);
        }