concentus.oggfile icon indicating copy to clipboard operation
concentus.oggfile copied to clipboard

ShortsToBytes methods can be changed into smaller code

Open StefH opened this issue 5 years ago • 1 comments

Just use:

short[] packets = opus.DecodeNextPacket();
byte[] buffer = new byte[packets.Length * 2];
Buffer.BlockCopy(packets, 0, buffer, 0, buffer.Length);

StefH avatar Mar 01 '19 18:03 StefH

Yeah, technically true. My only worry is if the endianness of the machine would affect the results, since the resulting byte array must be little-endian after the copy (that is to say, the 8-bit array must be the same as a list of 16-bit little endian values)

lostromb avatar Mar 01 '19 18:03 lostromb