locked
Creating Souce in PE errors RRS feed

  • Question

  • I am having a problem with Creating a Media souce inside PE.

    I have the necessary debug credentials and I have test signed my source dll, however during the creation process, the application hangs indefinitely.

     

    Basically my steps are:

    1. set MF_SESSION_REMOTE_SOURCE_MODE flag

    2. Use PMPHOST to use CreateObjectByCLSID passing in Source Resolver

    3. BeginCreateObjectFromURL returns no error

    4. EndCreateObjectURL hangs and app is non responsive.

     

    Is there something I am missing?

     

    Thanks!

    Friday, July 13, 2007 1:26 AM

Answers

  • I'm assuming that this Invoke() function is the one that gets invoked by the Source Resolver (i.e. the callback you gave as an argument to IMFSourceResolver::BeginCreateObjectFromURL).  You should probably be calling EndCreateObjectFromURL() from within this function; the expectation in the MF async model is that Invoke() will call EndXXX( pResult ). 

     

    From what you've told me, I'm going to guess that you're having some other thread try to call EndCreateObjectFromURL (that thread was probably waiting on m_hWait or something), and that's not guaranteed to work.

    Friday, July 20, 2007 5:46 PM

All replies

  • A couple things you could try to help narrow down your problem:

    • (Sanity check): Your IMFAsyncCallback is being invoked by the Source Resolver before you try EndCreateObjectFromURL, right?
    • Does this work if you run mfpmp.exe as an unprotected (regular) process?
    • Does source resolution work in-proc (i.e. no PMP)?
    • Because the Source Resolver is a remote object, you need to be careful which thread you're calling it from.  I recommend storing the pointer to any remote object in a GlobalInterfaceTable (http://msdn2.microsoft.com/en-us/library/ms678517.aspx)
    Monday, July 16, 2007 1:04 PM
  • Hi Becky,

     

    First of all, the source resolver works fine without PMP in a regular process.

    Second, I only use the source resolver in one thread, in one function (nowhere else), so I don't think I really need the GlobalInterfaceTable in this case.

     

    However, I have noticed that the call to my Callback::Invoke doesn't return until after the call to EndCreateObjectFromURL. Let me elaborate. This is my callback invoke function:

     

    STDMETHODIMP CSyncCallback::Invoke( IMFAsyncResult * pResult )

    {

    m_spResult = pResult;

    SetEvent(m_hWait);

    return S_OK;

    }

     

     

    I noticed that before I call EndCreateObjectFromURL, the first two lines of this function get executed (the m_spResult=pResult and SetEvent()), but the function does not hit the last line (return S_OK) until AFTER i call EndCreateObjectFromURL. I am not sure if this is correct behavior or not (as the event is being set, despite the invoke function returning).

     

    Can you please advise?

    Monday, July 16, 2007 9:24 PM
  • I'm assuming that this Invoke() function is the one that gets invoked by the Source Resolver (i.e. the callback you gave as an argument to IMFSourceResolver::BeginCreateObjectFromURL).  You should probably be calling EndCreateObjectFromURL() from within this function; the expectation in the MF async model is that Invoke() will call EndXXX( pResult ). 

     

    From what you've told me, I'm going to guess that you're having some other thread try to call EndCreateObjectFromURL (that thread was probably waiting on m_hWait or something), and that's not guaranteed to work.

    Friday, July 20, 2007 5:46 PM
  • Hi Becky,

    I am using the same source code given to me by MS (it came in a package from being a PMP licensee). They don't call EndCreateObjectFromURL from Invoke. Everything is done inside CPlayer::CreateMediaSource (BeginCreateObject, Callback.Wait(infinte), EndCreateObject....in order).

     

    Any other ideas?

     

    Sunday, July 22, 2007 12:53 AM