- March 24, 2007
- 12,073
- 7,459
- Home Country
- Germany
- Moderator
- #41
AW: Re: AW: Video and sound syncronisation
In contrast to MP1, we don't present the video surface/texture directly when it is pushed back from presenter to C#. It's passed to the GUI rendering and it can be used in 1 (or many!!!) controls, with applied transformations (rotate, scale etc.). The video frame is a "simple texture" in this case.
The time we do the callback then should take into account, how much time is need to render the complete GUI scene.
Didn't you quote this?
We use PresentEx with Interval One, shouldn't be the completly rendered frame be correctly presented?
I quote myself here as answer:If you ask from me I wouldn't try to do the scheduling in C# side. Is there any specific (mainly technical) reason why it can't be done in C++ side?
- The EVR callback does the StretchRect to fill the texture (created from RendertTarget).
- This texture is taken by the VideoBrush, which can be used to paint UI elements with video content.
- Shader effects can be applied when this texture gets presented (sharpen, greyscale...)
This means at least:
my idea to draw the GUI before a video frame arrives is useless, because the VideoBrush is used for UI elements and takes the currently available texture. Indeed it is correct to wait until the frame is there, then starting the rendering of whole GUI, including the VideoBrush'ed controls.
In contrast to MP1, we don't present the video surface/texture directly when it is pushed back from presenter to C#. It's passed to the GUI rendering and it can be used in 1 (or many!!!) controls, with applied transformations (rotate, scale etc.). The video frame is a "simple texture" in this case.
The time we do the callback then should take into account, how much time is need to render the complete GUI scene.
It could but... does the C# side code even try to present at optimal raster offset (v-sync)? Also if you move the sync code to C# side you will generate some uncescessary overhead (DirectX works on native side).
Didn't you quote this?
Windowed mode supports D3DPRESENT_INTERVAL_DEFAULT, D3DPRESENT_INTERVAL_IMMEDIATE, and D3DPRESENT_INTERVAL_ONE. D3DPRESENT_INTERVAL_DEFAULT and the D3DPRESENT_INTERVAL_ONE are nearly equivalent (see the information regarding timer resolution below). They perform similarly to COPY_VSYNC in that there is only one present per frame, and they prevent tearing with beam-following. In contrast, D3DPRESENT_INTERVAL_IMMEDIATE will attempt to provide an unlimited presentation rate.
We use PresentEx with Interval One, shouldn't be the completly rendered frame be correctly presented?