The Decode() overloads that take in a byte[] in H264Decoder apply the provided offset twice. Meaning that any offset other than zero gets applied incorrectly. (And therefore failing to decode the data properly in most cases)
public bool Decode(byte[] encoded, int offset, int count, bool noDelay, out DecodingState state, out YUVImagePointer yuv)
{
state = 0;
yuv = new YUVImagePointer();
int state_ = 0;
unsafe
{
fixed (byte* P = &encoded[offset]) // <- pointer gets offsetted here
{
int success = native.DecodeAsYUV(decoder, ref P[offset], count, noDelay, ref state_, ref yuv); // <- but oh no, it gets offsetted here too
state = (DecodingState)state_;
return success==0;
}
}
}
The solution is simple, just remove one of the offsets.
The Decode() overloads that take in a byte[] in H264Decoder apply the provided offset twice. Meaning that any offset other than zero gets applied incorrectly. (And therefore failing to decode the data properly in most cases)
The solution is simple, just remove one of the offsets.