0

This is the FillBuffer function:

HRESULT CVCamStream::FillBuffer(IMediaSample *pms)
{
    REFERENCE_TIME rtNow;
    REFERENCE_TIME avgFrameTime = ((VIDEOINFOHEADER*)m_mt.pbFormat)->AvgTimePerFrame;

    rtNow = m_rtLastTime;
    m_rtLastTime += avgFrameTime;
    pms->SetTime(&rtNow, &m_rtLastTime);
    pms->SetSyncPoint(TRUE);

    BYTE *pData;
    pms->GetPointer(&pData);
    long lDataLen = pms->GetSize();

    ProcessFrame(hdc, &pData);

    return NOERROR;
}

and here what I do inside ProcessFrame:

void ProcessFrame(HDC hdc, BYTE **lpbitmap)
{
    BYTE *q = *lpbitmap;
    const int32_t height = 640;
    const int32_t width = 480;
    for (int y = 0; y < height; y++)
    {
        uint8_t* p = bgra_image_data;
        for (int x = 0; x < width; x++)
        {
            if (p[3] > 0) for (int i = 0; i < 3; i++) q[i] = p[i];

            p += 4;
            q += 3;
        }
    }
}

In details, I'm playing with the bytes of a BRGA images, with the same dimensions.

Well, using graphedt it works like a charm! Instead, selecting this filter as Skype source sometimes it renders completely black, sometimes it messes up everything - the image is not readable.

In any case after few seconds it crashes due to a write access violation. Do you see any evidence of errors in my code, that graphedt might ignore?

Mark
  • 4,338
  • 7
  • 58
  • 120
  • I've just noticed that Skype "forces" a smaller resolution! That's because I get such a weird behavior. – Mark Mar 22 '17 at 17:53
  • I confirm. I should take care of calling of `SetMediaType` and change all the sizes according. – Mark Mar 22 '17 at 18:06

0 Answers0