Question

This is going to be my first question in StackOverflow after several days looking for an explanation. Please, be gentle with me for asking because I know my problem is a bit bizarre to be a general problem.

I made a MF capture video application, based in the Microsoft example 'CaptureToFile'. It did work on Windows 7 x64. I upgraded to Visual Studio 2013 without problems. Problems arose when I try to put all the development on a Windows 8.1 x64 machine.

The app compiles and executes without error, but it's UNABLE to capture samples by using m_pReader->ReadSample() in asynchronous mode; only the first two samples arrive to OnReadSample method; and there must be 'control' samples, because the IMFSample is null in all of them. After that, the app gets 'hanged' waiting for data.

I've tried the original MFCaptureToFile sample with the same sad results.

Of course, I think hardware and software are similar (the same capture card with the same driver version, both are desktop PC...)

Do you know any possible reason for this behaviour? in Win7 everything is working flawless! Or at least, if you could light me a bit about new paths for finding what's happening

Thanks in advance

UPDATE: There is another 'player' in the game. Looking into the threads, I see that a worker thread is in 'RTWorkQ.dll', the real-time work queue container, specific only for Windows 8. I will go on investigating. In the meantime, if you have any idea, something to share, I'll be glad to hear you.

UPDATE 2: I've modified the sample MFCaptureToFile to get the video samples synchronously, because I thought the problem could be due to the asynchronous behaviour; related with the queues. I've to say that the problem persist even with this change. The second time it tries to read a sample, the application gets 'hanged' waiting for a reading that doesn't never arrives.

UPDATE 3: I've tried with the CaptureEngine sample application that uses another MF way to capture video (MFCaptureEngine). It builds and runs flawlessly but doesn't show any images when starting the 'preview' and doesn't record any useful, only non-playable files.

UPDATE 4: I've installed Visual Studio 2010 Ultimate in Windows 8 PRO. The sample MFCaptureToFile fails again in the sample. It's unable to read a 2nd sample from the frame grabber. I'm starting to think that can be an incompatibility between the capture card (Datapath VisionRGB-E1S) and Windows 8 PRO despite the driver assures it works fine in this platform and the test program shows images. Tomorrow I'm going to try the test with an external USB webcam.

Was it helpful?

Solution

Finally, I have figured out the reason of this problem.

With Windows 8.1 release Microsoft has introduced New AVStream Interfaces for Windows 8.1 There is a small but very important change in KS_FRAME_INFO structure - the new FrameCompletionNumber member.

An identifying sequence number for the frame in the completed queue. This number is used to verify proper frame order. When this value is 0, the frame was cancelled. This member is available starting with Windows 8.1.

DirectShow doesn't care about this number. And MediaFoundation cares.

So, you cannot just fix that on your user-mode side. The manufacture developers must release an update. Btw, I have two webcams - Logitech C270 and Creative Live Socialize HD. Logitech supports Metro while Creative does not.

I have successfully updated my driver with only a few lines of code (to set up FrameCompletionNumber properly).

UPD. similar thread http://www.osronline.com/showthread.cfm?link=255004

OTHER TIPS

It must be a problem of the frame grabber Datapath VisionRGB-E1S. I've tried with the brand-new USB webcam LifeCam Studio, and everything worked fine.

I will left for other future thread why this unpaired behaviour between Windows 8 and Windows 7, but it could be something related to the User-mode access...

I had the same kind of issue:

  • IMFSourceReader was obtained successfully

  • reader->SetCurrentMediaType() reported no error.

  • reader->ReadSample() was successful.

then OnReadSample() was called only once and the hrStatus argument 0x80070491

For me, the issue was that I modified the video subtype IMFMediaType, then applied to the reader as current media type.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top