locked
Access Violations when running EVRCustomPresenter sample RRS feed

  • Question

  • Hi everyone,

    has anyone been able to run the EVRCustomPresenter sample? I've used the source code downloaded from the source code gallery, see here (http://msdn.microsoft.com/en-us/library/bb970434%28v=VS.85%29.aspx) and here (http://msdn.microsoft.com/en-us/library/bb970516%28v=VS.85%29.aspx). I've built both projects (had to change the define in MFPlayer.h to NTDDI_WIN7), registered the DLL using regsvr32.exe, opened the movie file and activated the custom EVR presenter checkbox in the file dialog. When I try to play a movie (in my case wmv but doesn't seem to make any difference), I get an access violation in linklist.h when the method Clear() tries to release the samples (i.e. the line "n->item->Release()". Breaking with the debugger just before the problem happens, the __vfptr of n->item has a pointer address but the debugger cannot evaluate the three function call addresses (should be QueryInterface, Add, Release).Couldn't find anything yet which might cause the problem...

    Win7 32bit, Visual Studio 2008 SP, DirectX SDk from Feb 2010, ...

    Alex

     

    Tuesday, November 2, 2010 2:40 PM

Answers

  • Alex,

    That is definitely a bug in the linked list. (Annoyingly, I think I introduced this sometime between the Vista and Windows 7 SDKs.) I will update the sample on MSDN Code Gallery.

     

    - Mike

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2010 Microsoft Corporation. All rights reserved.

     


    Mike Wasson (SDK Documentation)
    • Marked as answer by ak_ventuz Friday, November 26, 2010 3:12 PM
    Tuesday, November 23, 2010 5:44 PM

All replies

  • Not to answer my own question, but the linklist.h seems to be wrong. The line " n->item->Release(); " doesn't make any sense since the AddRef on the "item" is done by the node, not the list itself. Removing that line at least gets the movie to play correctly, got to verify that I didn't cause a memleak by doing that modification...
    Tuesday, November 2, 2010 4:06 PM
  • I don't exactly have an answer for you but I had a similar problem a few years ago with DirectX when trying to get a video device handle. One of the issues was compiling with 64bit. DirectX libs were only 32bit. I'd get an access violation when acquiring the handle. I've also had access violations with DirectX when I've compiled with certain target platforms and run my program.

    My only suggestion is that you make sure your project uses the same .Net platform configuration as the example (i.e. /clr, /clr:pure, native etc. Not sure what it should be)

    Tuesday, November 2, 2010 9:52 PM
  • Hi,

    I have the EVR Presenter sample running on Windows 7, I had to add the line mtOptimal.CreateEmptytype();  to the EVRCustomPresenter::CreateOptimalVideoType method.

    This may not be the fix for the error you are seeing, can't remember exactly the error I was getting.

    I am using the DirectX SDK from June 2010.

    Hope you get it sorted, cheers Wilf

    Modified code:

    HRESULT EVRCustomPresenter::CreateOptimalVideoType(IMFMediaType* pProposedType, IMFMediaType **ppOptimalType)
    {
        HRESULT hr = S_OK;
       
        RECT rcOutput;
        ZeroMemory(&rcOutput, sizeof(rcOutput));

        MFVideoArea displayArea;
        ZeroMemory(&displayArea, sizeof(displayArea));

        // Helper object to manipulate the optimal type.
        VideoType mtOptimal;
     mtOptimal.CreateEmptyType(); //TODO fix by rw

        // Clone the proposed type.
        CHECK_HR(hr = mtOptimal.CopyFrom(pProposedType));

    Tuesday, November 16, 2010 3:57 PM
  • Hey,

    thanks for the replies you two. Still looks to me like the linklist simply has a bug...

    @Wilfie: The code I downloaded from the link above is a bit different, so I'm not sure if your fix still applies to it:

    hr = MFCreateMediaType(&pMTOptimal);
    if (FAILED(hr))
    {
        goto done;
    }

    hr = pProposedType->CopyAllItems(pMTOptimal);

     

    I'm currently sticking with the fix I proposed above for now. There are so many problems I'm currently facing with what I try to implement that a potential leak is the least of my problems. But thanks anyway

    Alex

    Monday, November 22, 2010 2:23 PM
  • Alex,

    That is definitely a bug in the linked list. (Annoyingly, I think I introduced this sometime between the Vista and Windows 7 SDKs.) I will update the sample on MSDN Code Gallery.

     

    - Mike

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2010 Microsoft Corporation. All rights reserved.

     


    Mike Wasson (SDK Documentation)
    • Marked as answer by ak_ventuz Friday, November 26, 2010 3:12 PM
    Tuesday, November 23, 2010 5:44 PM
  • Good thing to know the "fix" I did was correct... one open item solved, what feels like 523 still on the todo list for that project... ;)

    Friday, November 26, 2010 3:12 PM
  • Thanks to all for this very useful thread !
    Saturday, December 18, 2010 6:45 AM
  • >>I've built both projects (had to change the define in MFPlayer.h to NTDDI_WIN7), registered the DLL using regsvr32.exe, opened the movie file and activated >>the custom EVR presenter checkbox in the file dialog.

    I do not see any checkbox for the custom EVR presenter in the file dialog. where is it...

     

    chole

    Wednesday, December 22, 2010 7:36 PM
  • Hi Chole,

    in the File Open dialog it's in the bottom left corner above a text box for the id. You need to make sure it's the original MFPlayer rather than the MFPlayer2 sample.

    Cheers

    Thursday, December 23, 2010 12:52 PM