I'm trying to play .mp4 files from low-end camera. Because VLC does not support http digest md5 auth, I had to implement MediaInput class (some code here). But buffer that is passed from LibVLCSharp in Read() method is too short to hold whole downloaded file inside.
I'm reading file using HttpClient. Read data are stored in byte [] readedBytes
. Bytes are copied to byteSpan constructed using pointer and length passed from LibVLCSharp. On each Read() call, program reads 1MB chunk of data and copies in to the buffer, which size decreased till is less than 1 MB. That causes exception and results in not playing full video file.
public unsafe override int Read(IntPtr buf, uint len)
{
...
Span<byte> byteSpan = new Span<byte>(buf.ToPointer(), (int)len);
readedBytes.CopyTo(byteSpan);
}
How to handle this problem properly?
Is there any way to increase buffer size?