我的程序正在将位图帧作为视频绘制到 WPF 控件。
示例代码如下:
while(true)
{
mStream = gcnew UnmanagedMemoryStream((unsigned char*)jpegBuff, jpegBuffLenght);
JpegBitmapDecoder^ decoder = gcnew JpegBitmapDecoder(mStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
bitmapSource = decoder->Frames[0];
myWPFControl.DrawImage(bitmapSource)
}
我的代码遇到了两个问题:
"Insufficient memory to continue the execution of the program"
1)有时它在在线运行时会与消息一起崩溃JpegBitmapDecoder^ decoder = gcnew JpegBitmapDecoder(...)
2)有时它会因“访问冲突”消息而崩溃,这种情况下的调用堆栈如下:
有人可以告诉我代码中的问题。
非常感谢!
电通