Solved

TestCap based virtual video driver problems with Windows 8.1

Posted on 2014-04-07
1
623 Views
Last Modified: 2014-04-08
Hello everyone.

Our driver is based on a pretty old Microsoft sample driver named TestCap.
However, it has been working great for years (since 2006).
But the latest Windows 8.1 has changed something and our driver does not work
properly with Metro apps (e.g. Skype for Metro, Camera app). In desktop mode it
still works great with most applications.

It seems to me that I found the reason of the problem.
In my driver, I do not set correct presentation times for the stream.
With DirectShow client application, I receive the SRB_INDICATE_MASTER_CLOCK
event in HwReceiveControlPacket callback and therefore I am able to use this
clock to set timestamps.

case SRB_INDICATE_MASTER_CLOCK:
    PSTREAMEX pStrmEx = (PSTREAMEX)pSrb->StreamObject->HwStreamExtension;
    pStrmEx->hMasterClock = pSrb->CommandData.MasterClockHandle;
    break;


With MediaFoundation client application, I do not receive this event so I never
set correct timestamps.
Here's a piece of code:

if (pStrmEx->hMasterClock )
{             
    pDataPacket->PresentationTime.Time = pStrmEx->QST_StreamTime;
    pDataPacket->OptionsFlags |= KSSTREAM_HEADER_OPTIONSF_TIMEVALID |
KSSTREAM_HEADER_OPTIONSF_DURATIONVALID;
}
else
{
    // no clock or the preview stream, so just mark the time as unknown and
clear the timestamp valid flags
    pDataPacket->PresentationTime.Time = 0;
    pDataPacket->OptionsFlags &= ~(KSSTREAM_HEADER_OPTIONSF_TIMEVALID
|      KSSTREAM_HEADER_OPTIONSF_DURATIONVALID);
}

I'm not sure how to resolve this but I feel that this might be the reason of the
problem.
Should I create my own Clock in such case? Or maybe there is some other event
that MediaFoundation framework is signalling in order to set up master clock?

Your help is very appreciated.

Thanks
0
Comment
Question by:MrCookJr2011
1 Comment
 

Accepted Solution

by:
MrCookJr2011 earned 0 total points
ID: 39987881
Finally, I have figured out the reason of this problem. It's not about timestamps.

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 (many MF developers complain about not getting the OnReadSample callback). 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
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Viewers will learn the basics of making and using Impulse Kits in Ableton Live. Load new Impulse into an empty MIDI track: Fill the 8 empty sample slots with drum samples: Adjust parameters to tailor each sound as desired: Proceed to create be…
Viewers will learn how to include realistic velocity sensitivity to their Sampler instruments. Set the Vol<Vel parameter in the Filter/Global tab to your desired setting: Gather samples of hits of various intensity, and drag/drop into Velocity zon…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now