tags:

views:

31

answers:

1
CVCam::CVCam(LPUNKNOWN lpunk, HRESULT *phr) : 
    CSource(NAME("Virtual Cam"), lpunk, CLSID_VirtualCam)
{
    ASSERT(phr);
    CAutoLock cAutoLock(&m_cStateLock);
    // Create the one and only output pin
    m_paStreams = (CSourceStream **) new CVCamStream*[1];
    m_paStreams[0] = new CVCamStream(phr, this, L"Virtual Cam");
}

What's the reason to instantiate m_paStreams twice?

Does CAutoLock cAutoLock(&m_cStateLock); work for separate request(by different application) to this filter?

+2  A: 

I have no idea what this code is about, but I can assure you that m_paStreams is only initialized once in what you've posted.

It appears that m_paStreams is intended to be an array of pointers to CSourceStream objects. Presumably, it's possible to have more than one of these objects, hence, the array. Your code simply creates an array of size 1, and then for the first element of the array, creates the CVCamStream object.

Kelsey Rider