Sign in to follow this  
mrmrcoleman

Direct Show.

Recommended Posts

Hello. I am using Direct Show with Direct3D as in the Texture 3D9 example in the SDK. I noticed in a post on this forum a while ago that somebody had suggested inserting a Sleep(0) command in the main loop. What is this for? I am experiencing white flashes when the videos are playing and wondered if this could help. Kind regards. Mark Coleman

Share this post


Link to post
Share on other sites
If Windows thinks your process is dead it will paint the window white.

This will happen if you aren't processing the messages which are being sent to your window procedure or clearing the message queue. Make sure your message pump is still running and you actually act on the messages you get.


Sleep(0) gives up the remainder of the time which is allocated to the thread you call it from back to the system for use by other threads of equal or higher priority.

What the real effect of that will be depends on the context of where it's being used. In some cases it's a hack for broken graphics card device drivers...

Share this post


Link to post
Share on other sites
It's been my experience that on some systems, if you don't give up any of your time slice and you just keep executing and executing and executing, the other applications running start to act goofy... they don't get time to render their interfaces when they need to and such...


DirectShow by its nature is multi-threaded... this means you're relying on more than one thread getting execution time... hence it would seem to be a good idea to release some of your time slice

Share this post


Link to post
Share on other sites
Thank you for your replies.

S1CA, it is not the entire window that goes white, just the area of the screen where the video is being rendered to. Could this be the same problem?? I believe that I am dealing with all the messages that my program produces.

Thanks again.

Mark Coleman

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this