Passing a texture using a pointer in progress

It's hard to put this in a title, so let me explain.

I have an application that uses Direct3D to display some mesh and directshow (vmr9 + allocator) to play some video and then send the video frame as a texture to the Direct3D part to be applied to the mesh. The application should work 24/7. At least this allowed a restart every 24 hours, but not more often than that.

Now the problem is directshow seems to give problems after hours of playback, either due to the codec, video driver, or the video file itself. At this point, the application simply refuses to play the video. But the Direct3D part is still working fine, the grid is still displayed. After restarting the application, everything returns to normal.

So I am thinking about splitting the two parts into 2 different processes. So when the video process never plays, at least I can restart it immediately without losing part of Direct3D.

So, the actual question arises: is it possible to pass a texture from the video player to the direct3d process by passing a pointer, aka retrieves the texture of another process from the pointer? My initial guess is not possible due to protected memory addressing.

I have TCP communication setup on both processes, and don't worry about passing the pointer at this point.

It might be a crazy idea, but it will surprise you whenever possible.

0


source to share


5 answers


Yes, you can do it with Direct3D 9Ex. This only works with Vista and you must use Direct3DDevice9Ex. You can read about shared resources.



+2


source


Now the problem is directshow seems to give problems after hours of playback, either due to the codec, video driver, or the video file itself. At this point, the application simply refuses to play the video.



Why not just fix this error?

+1


source


If you allocate it as a separate process then I suspect it won't be possible, but if it was a child thread then they would have shared memory. believe.

0


source


Texture transfer doesn't work.

I would do it using the following methods:

  • Replace VMR with a custom renderer + allocator that puts the image into memory.
  • You are allocating memory for images from a shared memory pool.
  • After getting another image, you signal the event
  • The Direct3D process waits for this event and updates the mesh with the new texture

Please note that you need to transfer the image data to the graphics card. The big difference is that this transfer now takes place in the Direct3D application and not in the DirectShow application.

You can also try using VMR. I'm not sure if the custom allocation / rendering parts will allow you to map to shared memory.

0


source


Perhaps you could use Sample Grabber in your DirectShow host process to get the image as a system memory buffer. Then you can use WriteProcessMemory to write data to a pre-negotiated address (which you configure over TCP or whatever) in your Direct3D application.

0


source







All Articles