locked
CreateObjectFromURL First-chance exception RRS feed

  • Question

  • I am creating a test application that uses the href="https://msdn.microsoft.com/en-us/library/ms698996(v=vs.85).aspx SequencerSource similar to href="https://msdn.microsoft.com/en-us/library/ms697285(v=vs.85).aspx this .

    I load files into the SequencerSource one at a time, but every time I get to the second file I get an error.

    First-chance exception at 0x76B84598 in MFTest.exe: Microsoft C++ exception: bad_hresult at memory location 0x06CBF1D4

    HRESULT

    IPlayerN::CreateMediaSource(IMFMediaSource** ppSource, PCWSTRwszUrl, constDWORDdwFlags){

    TRACE_PLAYER((L"Player::CreateMediaSource"));

    HRESULThr = S_OK;

    MF_OBJECT_TYPEobjectType = MF_OBJECT_INVALID;

    IMFSourceResolver* pSourceResolver = NULL;

    IUnknown* pSource = NULL;

    try{

    IF_FAILED_THROW(hr = MFCreateSourceResolver(&pSourceResolver));

    IF_FAILED_THROW(hr = pSourceResolver->CreateObjectFromURL(

    wszUrl,

    MF_RESOLUTION_MEDIASOURCE,

    NULL,

    &objectType,

    &pSource

    ));  // I get error here

    IF_FAILED_THROW(hr = pSource->QueryInterface(IID_IMFMediaSource, reinterpret_cast<void**>(ppSource)));

    }

    catch(HRESULT){}

    SAFE_RELEASE(pSource);

    SAFE_RELEASE(pSourceResolver);

    returnhr;

    }

    I only get the error on the second file, the third, fourth, and so on get no error.

    If I turn off the notification for fist chance it seems to be handled and gets an hr = S_OK.

    Any Idea why I am getting this.

    Thanks in advance

    Monday, March 2, 2015 7:07 PM