Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.4, 5.0.1, 5.1.0 Beta 1
-
None
-
Windows 7
-
a2f078f1088827ec2bc066aaee7ca3199c6cb4eb
Description
The QVideoFrame::startTime and endTime is not set properly using the WMF backend on Windows. This is actually a big deal for one of the applications I'm trying to deploy on windows (works fine on Linux), which relies on the frame times to do per-frame video processing.
1.
When using QVideoProbe, I get video frames via videoFrameProbed properly. Here, the startTime and endTime is reported in "100 nanoseconds" instead of milliseconds. The "100 nanoseconds" is the default WMF unit, so a simple conversion is needed in MFTransform::makeVideoFrame (file mftvideo.cpp around line 638, seen in Qt 5.1.0 beta 1).
2.
When receiving frames using a class inheriting QAbstractVideoSurface, the present method gives always QVideoFrame frames with startTime and endTime set to -1 (default).
As far as I can see, the code presenting the frame is found in evrd3dpresentengine.cpp, D3DPresentEngine::presentSample.
Here it's just creating a QVideoFrame like so:
if (surface && updateTexture(surface))
{ m_surface->present(QVideoFrame(new TextureVideoBuffer(m_glTexture), m_surfaceFormat.frameSize(), m_surfaceFormat.pixelFormat())); }This means it is NOT setting the start and end time, even though the information is available. It should rather create the video frame object, then set start- and endtime from the IMFSample (and remember to convert to milliseconds!). And finally present the frame.