Sign in to follow this  

Threading is making me crazy

Recommended Posts

jad_salloum    100
can anybody help tell me what is wrong with this code for rendering a video to a texture ?? is my Thread wrong ?? why i get jumping frames and the render texture take the texture of the backbuffer not the video ??? check this images plz : image 1 image 2
        void RenderIt(object sender, TextureRenderEventArgs e)
        {   lock (this)
            { textureVideo = e.Texture; }
        void MovieOver(object sender, EventArgs e)
        {  video.Stop();
            video.Play(); }
        private void InitializeVideo()
        {   string path = @"..\..\clock.avi";
                video = Video.FromFile(path);
                video.Ending += new System.EventHandler(this.MovieOver);
                video.TextureReadyToRender += new TextureRenderEventHandler(this.RenderIt);
       public void Initialize()
        {   thread = new Thread(new ThreadStart(InitializeVideo));
        public void RenderTexture()
            DrawVB(device, VB, textureVideo, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);}

[Edited by - jad_salloum on December 3, 2006 3:19:37 AM]

Share this post

Link to post
Share on other sites
jollyjeffers    1570
Constantly bumping your thread and still not getting any ideas might well be a good indication that your question is badly phrased or that, quite simply, no one knows the answer to your question - or, more likely, a combination of both.

Instead of just posting and deleting pointless messages try posting back with your latest attempts at debugging, the latest information you've found, your theories, more details - anything that you think might help someone else answer your question.


Share this post

Link to post
Share on other sites
Spoonbender    1258

You lock(this) but you don't seem to unlock it.

lock (this)
{ textureVideo = e.Texture; }

It's unlocked right there, after the assignment. :)

But as jollyjeffers said, post back with more details on how the code is called, what you've found when debugging and so on

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