locked
IMFMediaEngine::TransferVideoFrame return E_FAIL on 64 bit Windows 8 Pro with GTS 250 graphic card

    Question

  • Hi Microsft Tech support and all,

    I Download the Media engine native C++ video playback sample from MSDN, When I run the sample code on 64 bit Windows 8 Pro with Nvidia GTS 250 graphic card, IMFMediaEngine::TransferVideoFrame return E_FAIL and throw a First-chance exception at 0x76D84B32 in MEPlaybackNative.exe: Microsoft C++ exception: _com_error at memory location 0x06B2DED8.
    I have updated the graphic driver with the lastest version 306.97, but the problem still exist. Can anyone give me some more suggestions ? any help will appreciate.

    Thursday, December 6, 2012 5:21 AM

Answers

  • This seems to be an issue with NVIDIA cards only (See this thread: Why IMFMediaEngine::TransferVideoFrame return E_FAIL and throw a exception on GTS 250 on 64 bit Wind). I think I've found a workaround if you do the following:

    1) You need to create your device with a feature level of 9.3 or lower in your call to D3D11CreateDevice.

    2) You also need to add multithreaded protection using the ID3D10MultiThread interface.

    My creation code now looks like this:

    const D3D_FEATURE_LEVEL featureLevelsRequested[] = 
    {
        // Playback seems to fail with 11 and 10 feature levels
        /*
        D3D_FEATURE_LEVEL_11_1,
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1, 
        D3D_FEATURE_LEVEL_10_0,
        */
        D3D_FEATURE_LEVEL_9_3, 
        D3D_FEATURE_LEVEL_9_2, 
        D3D_FEATURE_LEVEL_9_1
    };
    UINT numLevelsRequested = sizeof(featureLevelsRequested) / sizeof(featureLevelsRequested[0]);
    D3D_FEATURE_LEVEL featureLevelSupported;
    HRESULT hr;
    if(FAILED(hr = D3D11CreateDevice(NULL,
    		D3D_DRIVER_TYPE_HARDWARE,
    		NULL,
    		0,
    		featureLevelsRequested,
    		numLevelsRequested,
    		D3D11_SDK_VERSION,
    		&m_Device,
    		&featureLevelSupported,
    		&m_Context)))
    	{
    		return;
    	}
    
    // Multithreaded protection also needs to be enabled to allow the video player to safely access the device
    ID3D10Multithread* multiThread = nullptr;
    m_Context->QueryInterface(&multiThread);
    if(multiThread != nullptr)
    {
    	multiThread->SetMultithreadProtected(TRUE);
    	multiThread->Release();
    }
    

    So it seems like a threading issue on NVIDIA cards, but that's as far as I can tell. It certainly looks that way, as the errors weren't consistent, and our code would seem to freeze in different places each time (one time the video playback caused a blue screen). It seems to mostly work OK now, though there are still a couple of errors printed out during video playback:

    D3D11 ERROR: ID3D11DeviceContext::GetVideoProcessorFilterRange: The filter property 80 is not supported! [ STATE_GETTING ERROR #3145806: GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F02C.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F02C.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F150.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F150.
    The thread 0xc2c has exited with code 0 (0x0).
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x082DF6CC.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x082DF6CC.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0855F7D0.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0855F7D0.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0307EF40.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0307EF40.

    It'd still be nice to get a response from either Microsoft or NVIDIA on this issue. The problem is that we can't get a stack trace or anything, as it doesn't crash internally, it just doesn't work.


    Andrew Porritt GoGo-Robot Ltd www.gogo-robot.com

    • Marked as answer by igameengine Thursday, July 18, 2013 9:57 AM
    Friday, March 22, 2013 11:29 AM

All replies

  • Hi,

    How about the error value from IMFMediaEngine::GetError method
    http://msdn.microsoft.com/zh-cn/library/windows/desktop/hh447985(v=vs.85).aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 7, 2012 9:11 AM
  • Hi Jesse,

    The IMFMediaEngine::GetError method have been tried before I asked this question. IMFMediaEngine::GetError return me nothong but a null pointer. And I have built and run the Media engine native C++ video playback sample on some other 64 bit windows 8 Pro with intel hd graphic card or amd radeon graphic card, all have a expected result.  And when I create a D3D_DRIVER_TYPE_WARP device for the sample on Nvidia GTS 250 graphic card, also the the result is as expected but with a little slow performance. I have test some more windows 8 samples releated to media foundation and directx on Nvidia GTS 250 graphic card, All of the samples run as expected.  

    From the test results, it seem there is some bug in the implementation of IMFMediaEngine, Can you give me some more tip or resource to help me solve this problem?

    Best regards.

    Monday, December 10, 2012 1:52 AM
  • Hello,

    I can help you with this issue. Can you please generate a dump file at the point of the failure, upload it to your sky drive account and post the link in this thread? Once I have the dump file I can look at the call stack and let you know what is the likely cause of the problem.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, December 12, 2012 12:45 AM
    Moderator
  • Hi James,

    The link to the dump file of the sample is at https://skydrive.live.com/redir?resid=9DFB0B2CF780F6F!108

    Best regards.

    Wednesday, December 12, 2012 8:13 AM
  • I'm also having this problem too!  Any advice would be great
    Friday, December 14, 2012 9:06 AM
  • I'm having the same issue on my GeForce GTS 450.

    See this post:

    http://social.msdn.microsoft.com/Forums/en-US/mediafoundationdevelopment/thread/f21a03d7-d120-410f-a321-d523353bb6ee?prof=required

    I'm now using an AMD card to continue my work...

    Tuesday, January 29, 2013 10:59 AM
  • I'm having a similar problem, I ported the sample code into my project, but the engine throws exceptions when I load any video file, despite working fine in the sample. I can't link to my problem yet as I'm unverified, but you can see it's my other thread post ;)
    • Edited by AJMeredith Thursday, March 21, 2013 6:17 PM extra information
    Thursday, March 21, 2013 6:15 PM
  • This seems to be an issue with NVIDIA cards only (See this thread: Why IMFMediaEngine::TransferVideoFrame return E_FAIL and throw a exception on GTS 250 on 64 bit Wind). I think I've found a workaround if you do the following:

    1) You need to create your device with a feature level of 9.3 or lower in your call to D3D11CreateDevice.

    2) You also need to add multithreaded protection using the ID3D10MultiThread interface.

    My creation code now looks like this:

    const D3D_FEATURE_LEVEL featureLevelsRequested[] = 
    {
        // Playback seems to fail with 11 and 10 feature levels
        /*
        D3D_FEATURE_LEVEL_11_1,
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1, 
        D3D_FEATURE_LEVEL_10_0,
        */
        D3D_FEATURE_LEVEL_9_3, 
        D3D_FEATURE_LEVEL_9_2, 
        D3D_FEATURE_LEVEL_9_1
    };
    UINT numLevelsRequested = sizeof(featureLevelsRequested) / sizeof(featureLevelsRequested[0]);
    D3D_FEATURE_LEVEL featureLevelSupported;
    HRESULT hr;
    if(FAILED(hr = D3D11CreateDevice(NULL,
    		D3D_DRIVER_TYPE_HARDWARE,
    		NULL,
    		0,
    		featureLevelsRequested,
    		numLevelsRequested,
    		D3D11_SDK_VERSION,
    		&m_Device,
    		&featureLevelSupported,
    		&m_Context)))
    	{
    		return;
    	}
    
    // Multithreaded protection also needs to be enabled to allow the video player to safely access the device
    ID3D10Multithread* multiThread = nullptr;
    m_Context->QueryInterface(&multiThread);
    if(multiThread != nullptr)
    {
    	multiThread->SetMultithreadProtected(TRUE);
    	multiThread->Release();
    }
    

    So it seems like a threading issue on NVIDIA cards, but that's as far as I can tell. It certainly looks that way, as the errors weren't consistent, and our code would seem to freeze in different places each time (one time the video playback caused a blue screen). It seems to mostly work OK now, though there are still a couple of errors printed out during video playback:

    D3D11 ERROR: ID3D11DeviceContext::GetVideoProcessorFilterRange: The filter property 80 is not supported! [ STATE_GETTING ERROR #3145806: GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F02C.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F02C.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F150.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x07F1F150.
    The thread 0xc2c has exited with code 0 (0x0).
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x082DF6CC.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x082DF6CC.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0855F7D0.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0855F7D0.
    D3D11 ERROR: ID3D11DeviceContext::VideoProcessorSetStreamRotation: Device does not support rotation! [ STATE_SETTING ERROR #3146033: VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED]
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0307EF40.
    First-chance exception at 0x75D44B32 in Boomba.exe: Microsoft C++ exception: _com_error at memory location 0x0307EF40.

    It'd still be nice to get a response from either Microsoft or NVIDIA on this issue. The problem is that we can't get a stack trace or anything, as it doesn't crash internally, it just doesn't work.


    Andrew Porritt GoGo-Robot Ltd www.gogo-robot.com

    • Marked as answer by igameengine Thursday, July 18, 2013 9:57 AM
    Friday, March 22, 2013 11:29 AM
  • Thanks for sharing your solution Andrew.
    Also, the newest NVidia drivers 314.22 seem to fix the issue on my GTS 450. I can use the D3D device up to level 11.0 (couldn't test level 11.1 though).
    Tuesday, March 26, 2013 3:32 PM
  • We are having the same issue. We require D3D 11 so using lower feature levels is not an effective solution. We still get this issue on 314.22. Our app is 3D heavy as well as using video. As with others here the problem does not occur on any other hardware, only NVidia; WARP is also fine, but way too slow for us. This only happens using the new Windows 8 App API, using the old Desktop API the video works on all hardware (as we also have a Desktop build). However the Desktop API is not available to Store Apps, so that doesn't help. The video either does not play, or plays corrupt, or occasionally causes a BSOD.

    I will also report this on the NVidia thread here.

    Friday, April 5, 2013 3:46 PM