Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:48:06+00:00 2026-06-18T10:48:06+00:00

The MSDN page about Filter threading considerations for flushing data gives a suggested implementation

  • 0

The MSDN page about Filter threading considerations for flushing data gives a suggested implementation of BeginFlush and EndFlush for a filter with single input pin and one or more output pins.

How should this be extended safely for a filter with multiple input pins? Should DeliverBeginFlush and DeliverEndFlush be called for every input pin, or for the first or last input pin to receive BeginFlush/EndFlush? Is the exact sequence of operations between input pins important? Is it allowable for one input pin to finish both BeginFlush and EndFlush and receive new samples before other pins have received BeginFlush and/or EndFlush? Are there any other considerations or gotchas in this situation?

At the moment my filter with multiple input pins is sometimes receiving stale queued samples from upstream after EndFlush has completed and I’m trying to diagnose whether the bug is in my filter or further upstream. The input pins are queueing samples for another thread that generates output samples so I do make use of the m_hSomeEventThatReceiveNeedsToWaitOn technique to unblock the thread that does output processing.

HRESULT CMyInputPin::BeginFlush()
{
    CAutoLock lock_it(m_pLock);

    // First, make sure the Receive method will fail from now on.
    HRESULT hr = CBaseInputPin::BeginFlush();

    // Force downstream filters to release samples. If our Receive method
    // is blocked in GetBuffer or Deliver, this will unblock it.
    for (each output pin)
    {
    hr = pOutputPin->DeliverBeginFlush();
    }

    // Unblock our Receive method if it is waiting on an event.
    SetEvent(m_hSomeEventThatReceiveNeedsToWaitOn);

    // At this point, the Receive method can't be blocked. Make sure 
    // it finishes, by taking the streaming lock. (Not necessary if this 
    // is the last step.)
    { 
    CAutoLock lock_2(&m_csReceive);

    /* Now it's safe to do anything that would crash or hang 
       if Receive were executing. */
    }
    return hr;
}

HRESULT CMyInputPin::EndFlush()
{
    CAutoLock lock_it(m_pLock);
    for (each output pin)
        hr = pOutputPin->DeliverEndFlush();
    return CBaseInputPin::EndFlush();
}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:48:07+00:00Added an answer on June 18, 2026 at 10:48 am

    In my code I just dumbly deliver a flush downstream for every one I receive. It seems to work without problems.

    HRESULT JoinFilterInputPin::BeginFlush()
    {
        JoinFilter* filter = (JoinFilter*)m_pFilter;
        CAutoLock lock(m_pLock);
        CBaseInputPin::BeginFlush();
        filter->output->DeliverBeginFlush();
        return S_OK;
    }
    
    HRESULT JoinFilterInputPin::EndFlush()
    {
        JoinFilter* filter = (JoinFilter*)m_pFilter;
        CAutoLock lock(m_pLock);
        filter->output->DeliverEndFlush();
        return CBaseInputPin::EndFlush();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the MSDN page about Data deduplication API , and it seems there's no
I am reading SQL Server lock escalation from MSDN Page about SQL Server lock
I was recently looking at my web.config and pulled up the MSDN page about
I was looking at Example 2 on this msdn page about Thread synchronization with
From a MSDN page , about .NET Framework versions, we know that each version
I found this article on MSDN talking about Cross-page posting . I never worked
Just reading through the MSDN page about new .NET 4.0 feature SpinLock and can
On the MSDN page about Process.EnterDebugMode it says: Some operating system processes run in
I am teaching myself about the entity framework using a tutorial found at http://msdn.microsoft.com/en-us/data/jj591506
At MSDN page for Stopwatch class I discovered link to interesting article which makes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.