private ResultCode DecodeInterleavedInternal(ServiceCtx context, OpusDecoderFlags flags, bool reset, bool withPerf) { ulong inPosition = context.Request.SendBuff[0].Position; ulong inSize = context.Request.SendBuff[0].Size; ulong outputPosition = context.Request.ReceiveBuff[0].Position; ulong outputSize = context.Request.ReceiveBuff[0].Size; ReadOnlySpan <byte> input = context.Memory.GetSpan(inPosition, (int)inSize); ResultCode result = _decoder.DecodeInterleaved(reset, input, out short[] outPcmData, outputSize, out uint outConsumed, out int outSamples); if (result == ResultCode.Success) { context.Memory.Write(outputPosition, MemoryMarshal.Cast <short, byte>(outPcmData.AsSpan())); context.ResponseData.Write(outConsumed); context.ResponseData.Write(outSamples); if (withPerf) { // This is the time the DSP took to process the request, TODO: fill this. context.ResponseData.Write(0UL); } } return(result); }
public IHardwareOpusDecoder(int sampleRate, int channelsCount, int streams, int coupledStreams, OpusDecoderFlags flags, byte[] mapping) { _decoder = new MultiSampleDecoder(sampleRate, channelsCount, streams, coupledStreams, mapping); _flags = flags; }
public IHardwareOpusDecoder(int sampleRate, int channelsCount, OpusDecoderFlags flags) { _decoder = new Decoder(sampleRate, channelsCount); _flags = flags; }