hashbrown

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!



Re: Media Foundation Development Creating Souce in PE errors

Becky Weiss - MSFT

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)





Re: Media Foundation Development Creating Souce in PE errors

hashbrown

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





Re: Media Foundation Development Creating Souce in PE errors

Becky Weiss - MSFT

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.






Re: Media Foundation Development Creating Souce in PE errors

hashbrown

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