cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

waji_293216
New Contributor

i use the same application to capture the camera data use cyusb.

   

but now i found that in the system windowx xp it works very well, int win7 32 or vistat system it loss data very strong.

   

my application code is: the code means capture vide size 1280*720 ,in xp system the return data alomost is 1280*720,

   

but in win7 32 or vista system it is alomost less 1280*720. i check the driver in win7 and vista is right.

   

by the way the xp system and win7 system vista is install in the same pc.

   

can any people help me?  thanks.

   

DWORD WINAPI Camera_Thread(void *param)
{

    CCyUSBEndPoint*     pInEndpt    = pUSB->BulkInEndPt;
    int QueueSize  = 2;
    PUCHAR            *inContext        = new PUCHAR[QueueSize];
    OVERLAPPED        *inOvLap = new OVERLAPPED[QueueSize];
    PUCHAR            *buffers        = new PUCHAR[QueueSize];
    for (int i=0; i< QueueSize; i++)
    {    
        inOvLap.hEvent = CreateEvent(NULL, false, false, NULL);
    }
    pInEndpt->TimeOut = 1000;
    pInEndpt->SetXferSize(1024*1024);

    for(int i=0;i<QueueSize;i++)
        buffers = new unsigned char [1024*1024];

    for(int i=0;i<QueueSize;i++)
        inContext = pInEndpt->BeginDataXfer(buffers, 1024*1024, &inOvLap);
    LONG  dwBytes     = 0;
    int i=0;
    while(m_bPlaying)
    {
        pInEndpt->WaitForXfer(&inOvLap, 1000);

        pInEndpt->FinishDataXfer(buffers, dwBytes, &inOvLap, inContext);

        inContext = pInEndpt->BeginDataXfer(buffers,1024*1024,&inOvLap);
        if(dwBytes==1280*720)
        {
            pCameraFrameCount++;
        }

        i++;
        if(i==QueueSize)
        {
            i=0;
        }
    }
       
    return 0;
}

0 Likes
2 Replies
Anonymous
Not applicable

 Did you take a usb trace and see what is causing the data loss?

0 Likes
Anonymous
Not applicable

 Also try setting a smaller Xfersize.

   

You can still use 1024*1024 value in begin wait finish xfer.

0 Likes