locked
Using Graphics Diagnostic with Store App, C#/C++, DirectX, MediaFoundation

    Question

  • I'm developing a Store App that use the camera. The UI is written in C#/XAML and a video filter (MFT) is implemented with DirectX in a C++ component. I also use a SurfaceImageSource component to draw into with DirectX.

    I'd like to use the Graphics Diagnostics feature to solve an issue in my DirectX code, but each time I try to run it, the following error is thrown:

    First-chance exception at 0x71DB17FB (dxcapturereplay.dll) in UfnCamera.exe: 0xC0000005: Access violation reading location 0x00000000.

    I tried to step into the assembly to find when the exception is thrown, and I found that this happens just after my MFT received the message MFT_MESSAGE_NOTIFY_START_OF_STREAM, and it seems to be at the first input frame decoding. Here is the call stack:

    dxcapturereplay.dll!GRFXTool::ToolDXGIKeyedMutexGenerated<struct idxgikeyedmutex>::AcquireSync(unsigned __int64,unsigned long)
    mfplat.dll!CMFDX11SurfaceBuffer::InternalUnlock2D(void)
    mfmjpegdec.dll!CBufferLock::~CBufferLock(void)
    mfmjpegdec.dll!CMJPGMFTDataHandler::DoProcessSample(unsigned long,struct IMFSample * *,unsigned long *,unsigned long *)
    mfmjpegdec.dll!CMFTSimpleDataHandler::InternalProcessOutput(unsigned long,unsigned long,struct _MFT_OUTPUT_DATA_BUFFER *,unsigned long *)
    mfmjpegdec.dll!CMFTSimpleDataHandler::ProcessOutput(unsigned long,unsigned long,struct _MFT_OUTPUT_DATA_BUFFER *,unsigned long *)
    mfmjpegdec.dll!CMFTBase::ProcessOutput(unsigned long,unsigned long,struct _MFT_OUTPUT_DATA_BUFFER *,unsigned long *)
    mfcore.dll!CMFTWrapperAsync::GetOutput()
    mfcore.dll!CMFTWrapperAsync::ProcessingLoop()
    mfcore.dll!CMFTWrapperAsync::ProcessingLoopAsyncCallback::Invoke(struct IMFAsyncResult *)
    RTWorkQ.dll!CPlatform::InvokeCallback_NoPlatformLock(struct IMFAsyncResult *)
    ntdll.dll!TppExecuteWaitCallback()
    ntdll.dll!TppWaitCompletion()
    ntdll.dll!TppWorkerThread()
    kernel32.dll!@BaseThreadInitThunk@12()
    ntdll.dll!__RtlUserThreadStart()
    ntdll.dll!__RtlUserThreadStart@8()

    The debug info for the topmost method (AcquireSync) seems to be incorrect: for my version of dxcapturereplay.dll (6.3.9600.16384 winblue_rtm.130821-1623), the exception is thrown at GRFXTool::ToolDXGIKeyedMutexGenerated<IDXGIKeyedMutex>::AcquireSync+69Eh (71C417FB).

    The assembly around there is:

    71C417F0  lea         ecx,[ebx+4]  
    71C417F3  call        GRFXTool::ToolResource::GetInnerUnknown (71BE7DC8h)  
    71C417F8  push        dword ptr [ebp+14h]  
    71C417FB  mov         ecx,dword ptr [eax]  

    The problem is that GetInnerUnknown function return NULL in eax, and the exception is thrown when dereferencing eax.

    So my questions:

    - Is it possible to use the Graphics Diagnostics in my case ?

    - Did I forgot something ? (I saw somewhere that I need to debug in "Native Only" mode, but this crashes as well)

    - Does the Graphics Diagnostics tools works when there are several Swap chains ? In my case, I think there are 2 swap chains: the XAML one, and the Media Foundation one.

    Wednesday, February 19, 2014 11:28 AM