Using IStreamBufferSink: application crash on IStreamBufferSink::LockProfile() call [WinXP]

First of all, I'd like to see example of valid using IStreamBufferSink (maybe without IStreamBufferSource). Please post it anyone; strange but MSDN containt no such example.
My steps are:
ICaptureGraphBuilder2 *g_pCapture;
CComQIPtr<IBaseFilter> pSinkFilter(pSink);
g_pCapture->SetFiltergraph(g_pGraph);
g_pGraph->AddFilter(pSrcFilter, L"Capture filter");
g_pGraph->AddFilter(pSinkFilter, L"SBE filter");
g_pCapture->RenderStream (&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
pSrcFilter, NULL, pSinkFilter);

IStreamBufferSink *pSinkrec;
pSinkFilter->QueryInterface(IID_IStreamBufferSink, (LPVOID *)&pSinkrec);
pSinkrec->LockProfile("test.sbe"); // crash here, and refer to sbeio.dll

//
What's wrong?

[864 byte] By [dkrot] at [2007-12-24]
# 1

A couple of thoughts:

- Doesn't LockProfile take a WSTR?

- Doesn't look like you are checking return codes. Might tell you something. In particular, I'd want to make sure pSinkrec got populated correctly.

- Does test.sbe already exist? Docs say it mustn't.

- Have you tried a NULL for LockProfile?

- Have you looked at the graph the RenderStream call creates? It may not be what you intend.

LGS at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...

Software Development for Windows Vista

Site Classified