Compartir a través de


Implementing IMediaObject::FreeStreamingResources

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

It is important that your code releases any allocated memory before the plug-in object is destroyed. Windows Media Player calls FreeStreamingResources to allow you to do this. For safety, the sample created by the plug-in wizard includes a call to FreeStreamingResources in the FinalRelease method to ensure that the memory is freed. You must add the following code to FreeStreamingResources for the Echo sample:

// Test whether a buffer exists.
if (m_pbDelayBuffer)
{
    delete m_pbDelayBuffer;
    m_pbDelayBuffer = NULL;
    m_pbDelayPointer = NULL;
    m_cbDelayBuffer = 0;
}

Working with Streaming Resources