Michael Chourdakis
Michael Chourdakis

Reputation: 11178

Speeding up the Source Reader

The idea is to make the IMFSourceReader return samples faster in order to enhance video editing. It may occur for example that I have to render to the preview 3-4 layers (say, in a video wall) and I want to speed up the result of ReadSample as much as possible.

I' ve tried the rate control. The functions indicate that "thin" mode is supported along with a rate of 2.0, for example:

    CComPtr<IMFRateSupport> rs;
    CComPtr<IMFRateControl> rc;
    r->GetServiceForStream((DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_RATE_CONTROL_SERVICE, __uuidof(IMFRateSupport), (void**)&rs);
    r->GetServiceForStream((DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_RATE_CONTROL_SERVICE, __uuidof(IMFRateControl), (void**)&rc);
    float pf = 0;
    auto hr = rs->IsRateSupported(true, 1.0f, &pf);
    hr = rs->IsRateSupported(false, 1.0f, &pf);
    hr = rs->IsRateSupported(true, 2.0f, &pf);
    hr = rs->IsRateSupported(false, 2.0f, &pf);
    hr = rc->SetRate(true, 2.0f);

All calls return S_OK, but I don't see any difference in the renderer samples when I get them through the Source Reader.

I 've also tried to skip manually, in a for loop, samples that do not have the 'MFSampleExtension_CleanPoint' attribute. But I found out that all the samples I get from the reader do indeed have the attribute set:

auto u1 = MFGetAttributeUINT32(pSample, MFSampleExtension_CleanPoint, FALSE);
if (!u1) { never enters here }

What are my options?

Best,

Upvotes: 0

Views: 52

Answers (0)

Related Questions