Please change the NAudio.WindowsMediaFormat.NSSBuffer class Read and Write methods. Under load you will get an OverflowException such as this:
System.OverflowException: Arithmetic operation resulted in an overflow.
at System.IntPtr.ToInt32()
at NAudio.WindowsMediaFormat.NSSBuffer.Read(Byte[] buffer, Int32 offset, Int32 count)
at NAudio.WindowsMediaFormat.WmaStream.Read(Byte[] buffer, Int32 offset, Int32 count)
The change should check the system architecture and perform the correct casting to an integer type like so:
IntPtr src;
if (IntPtr.Size == 8) {
src = (IntPtr)(m_BufferPtr.ToInt64() + m_Position);
}
else {
src = (IntPtr)(m_BufferPtr.ToInt32() + m_Position);
}
I have tested this change and it does fix this exception.
Please see MSDN at http://msdn.microsoft.com/en-us/library/system.intptr.toint32.aspx for details on this exception as it reads: OverflowExceptions will occur on a 64-bit platform. The value of this instance may be too large or too small to be represented as a 32-bit signed integer.
Thanks for such an amazing library. :)
System.OverflowException: Arithmetic operation resulted in an overflow.
at System.IntPtr.ToInt32()
at NAudio.WindowsMediaFormat.NSSBuffer.Read(Byte[] buffer, Int32 offset, Int32 count)
at NAudio.WindowsMediaFormat.WmaStream.Read(Byte[] buffer, Int32 offset, Int32 count)
The change should check the system architecture and perform the correct casting to an integer type like so:
IntPtr src;
if (IntPtr.Size == 8) {
src = (IntPtr)(m_BufferPtr.ToInt64() + m_Position);
}
else {
src = (IntPtr)(m_BufferPtr.ToInt32() + m_Position);
}
I have tested this change and it does fix this exception.
Please see MSDN at http://msdn.microsoft.com/en-us/library/system.intptr.toint32.aspx for details on this exception as it reads: OverflowExceptions will occur on a 64-bit platform. The value of this instance may be too large or too small to be represented as a 32-bit signed integer.
Thanks for such an amazing library. :)