Home > Archive (Community help, from old helpdesk) > Media Player SDK crash when play a lot media files

Media Player SDK crash when play a lot media files

Avatar image
Aug 23, 2015
Archive Agent wrote
long time ago I told you even I'm not use the audio effect, when play a lot media player , the Media Player SDK still crash, but I'm not found the source. today when I'm test I found the Visual Studio 2012 output the message:

Program "[159432] WpfApplication2.vshost.exe: Managed (v4.0.30319)" has exited, the return value is 250477278 (0xeedfade).
Program "[159432] WpfApplication2.vshost.exe: Program Trace" has exited, the return value is 0 (0x0).

So, do you know Is there any position will throw the exception 250477278 (0xeedfade) on the SDK or filter??
(test just like before, the 2 video file. play next every time playing about 10 second, about play 800+ it will crash)

qakmak on February 25, 2014 9:51 PM
Completed
0
Vote
Reply
24 Answers
Aug 23, 2015
Archive Agent agent wrote
qakmak

Did you find the problem source?

on March 01, 2014 18:58
Aug 23, 2015
Archive Agent agent wrote
qakmak

I search it , looks like that's more about filter problem because I'm using .NET4.0 SDK. I think only Delphi filter will gonna throw it.

on March 05, 2014 13:55
Aug 23, 2015
Archive Agent agent wrote
qakmak

I think I found the problem source. looks like the exception on here:

this.frameBitmap = new new WriteableBitmap(e.Width, e.Height, 72.0, 72.0, PixelFormats.Bgr24, null);

If play a lot file, about 800-900, this place display: Out of memory exception. you can search google about: writeablebitmap memory

I think maybe it's a bug, or maybe we can't create a lot writeablebitmap every time new media file size changed.

So can we changed the writablebitmap on WPF?? replace it use other control??

very unfortunately before I want use winform panel replace it . but I found if use winform panel in wpf , there is topmost problem, also I'm not let the panel display.

Is there any better choice on wpf?

on March 06, 2014 20:17
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

if (frameBitmap == null || frameBitmap.PixelWidth != e.Width || frameBitmap.PixelHeight != e.Height)
{
frameBitmap = new WriteableBitmap(e.Width, e.Height, 72, 72, PixelFormats.Bgr24, null);

BeginInit();
Source = frameBitmap;
EndInit();
}

Code is correct. Bitmap recreated only if frame resolution changed. So, one time per file usually.

WriteableBitmap is a fastest way for WPF.

You can made your own implementation of rendering. You can catch frames using OnVideoFrameBuffer event.

on March 06, 2014 20:47
Aug 23, 2015
Archive Agent agent wrote
qakmak

Hi Roman, I think I find a very good way to replace the writeablebitmap and I just test it , very less cpu usage. but because I don't know more about directshow , can you see it :

http://dedjo.blogspot.com/2008/04/webcam-control-with-wpf-or-how-to.html (you can download the source code, there is will some exception when start debug, but you can ignore it)

and if you think it is very good, can you add it on you sdk? thank you.

on March 06, 2014 20:54
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

We've used this way before but it's a instability problem happens sometimes. You can use it in your code with OnVideoFrameBuffer event. So, it can be faster but caused too more problems with us.

Also it's WPF code, not DirectShow.

on March 06, 2014 21:00
Aug 23, 2015
Archive Agent agent wrote
qakmak

ok. I'll try to test it..... but I still think Writeablebitmap not a good solution.....

on March 06, 2014 21:05
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Why? It's fast and stable. Of course, you can play with InteropBitmap but i'm not sure that it's better and safe.

on March 6, 2014 9:10 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

you know I'm not use MediaPlayer, I'm using MediaPlayerSlave, So I just need a control here just can normal display the video.

Writeablebitmap:
1.it has size chaned problem every time need instance it. that is a problem now.
2.it is need so many CPU. I need the window on 2 window but that is so slow....

you should keep it before , let us just like a option. now little hard to know and use it.

on March 6, 2014 9:15 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

do you have any sample use InteropBitmap with OnVideoFrameBuffer? or old code?

on March 6, 2014 9:34 PM
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

No. But your article code is ok.

Frame event includes RGB24 data pointer.

on March 6, 2014 10:10 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

Oh......
that article not mine.
Can you write a sample code when has a free time please?
What exactly the instability problem you before said?

on March 6, 2014 10:16 PM
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Yes, maybe.

Well, on some PCs it's just crashed, worked too slowly, or rendered incorrectly. All of this in .Net 3.5 SP1.

on March 6, 2014 10:24 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

that is really terrible. My all customer use XP+.NET4.0+Dual-core2.0+

I hope it don't be like that.....because I think that a final solution for WPF crash problem.....

on March 6, 2014 10:30 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

Thank you.

on March 6, 2014 10:30 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I'm just use InteropBitmap, I don't think it can save a lot cpu. maybe because I'm use Marshal.Copy(e.Buffer....) way, not get the stream from IntPtr.

more important problem is , the PC Memory very unstable.......

on March 7, 2014 12:11 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I know now the problem source is create a lot Writeablebitmap. so I download WriteablebitmapEx, and when the video size changed, I'm not instace a new writeablebitmap. I'm use Resize method

this.ImageSource.Resize(e.Width, e.Height, WriteableBitmapExtensions.Interpolation.Bilinear);

but it need PixelFormats.Pbgra32, but when I'm changed it. it throw another exception said the buffer size not enough

on March 7, 2014 1:16 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

again I was wrong, I try use winform sdk try play about 800-900
still crash when play 810 file....

there is a messagebox display: titile: ffdshow error, content: failed to load ffmpeg.dll

on March 7, 2014 3:46 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

There is some crash picture, Maybe helping to you to find the problem source.(I'm already disable the audio effect, So that's not about Audio Effect)
I'm very sure It will throw exception about play 800-850(every time play 10 second and play next, there is only 2 file for test)

picture:

FFDSHOW(Video encode+Audio encode)+Haali aplitter:
https://www.dropbox.com/s/6ini9822tlomnyb/FFDSHOW%2BHaali.png
https://www.dropbox.com/s/vmgbe5gl4yshbvi/FFDSHOW%2BHaali2.png
https://www.dropbox.com/s/9edrm4t7j3u8f6p/FFDSHOW%2BHaali3%28winform%29.png (winform demo)

FFDSHOW(Video encode+Audio encode)+LAVFilter plitter:
https://www.dropbox.com/s/x0vtf08642sb39m/FFDSHOW%2BLAVFilter.png
https://www.dropbox.com/s/uyzls65p6wfhh73/FFDSHOW%2BLAVFilter2.png
https://www.dropbox.com/s/jfypgr9fqh5w9j1/FFDSHOW%2BLAVFilter3.png

on March 7, 2014 7:06 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

CoreAVC video decode + FFDSHOW audio decode + Haali aplitter throw Out of memory exception
when play 510 media file

Can you help me find the problem please?
Thank you very much.

on March 7, 2014 10:23 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I just ignore Out of memory, and still run it. now ti will throw HRESULT:0x88980003 when play 511 file.

on March 7, 2014 10:26 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I think current problem very clear .You totally can reproduce.
This is a sample code. please download and try it.
https://www.dropbox.com/s/xu2qneqncfhz387/CrashSample.rar

I think if this problem finish, Media Player SDK very stable.

on March 8, 2014 8:23 AM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I'm totally wrong, that's not a problem what I searching. Sorry, just ignore these messages before I write. I'm still check and analyzing, So don't close it , until I confirm or find the problem.

on March 9, 2014 10:28 PM
Aug 23, 2015
Archive Agent agent wrote
qakmak

I found a filter problem. maybe that's not the about the SDK. still testing.

on April 12, 2014 9:28 PM