Skip to content

Commit

Permalink
Fix up error reporting for VideoTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Aug 6, 2020
1 parent 398f16a commit 4024860
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
19 changes: 13 additions & 6 deletions PCSamples/Graphics/VideoTexturePC12/MediaEnginePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,22 @@ void MediaEnginePlayer::OnMediaEngineEvent(uint32_t meEvent)
break;

case MF_MEDIA_ENGINE_EVENT_ERROR:
#ifdef _DEBUG
#ifdef _DEBUG
if (m_mediaEngine)
{
ComPtr<IMFMediaError> error;
m_mediaEngine->GetError(&error);
USHORT errorCode = error->GetErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u", errorCode);
OutputDebugStringA(buff);
if (SUCCEEDED(m_mediaEngine->GetError(&error)))
{
USHORT errorCode = error->GetErrorCode();
HRESULT hr = error->GetExtendedErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u (%08X)\n", errorCode, static_cast<unsigned int>(hr));
OutputDebugStringA(buff);
}
else
{
OutputDebugStringA("ERROR: Media Foundation Event Error *FAILED GetError*\n");
}
}
#endif
break;
Expand Down
17 changes: 12 additions & 5 deletions UWPSamples/Graphics/VideoTextureUWP/MediaEnginePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,18 @@ void MediaEnginePlayer::OnMediaEngineEvent(uint32_t meEvent)
if (m_mediaEngine)
{
ComPtr<IMFMediaError> error;
m_mediaEngine->GetError(&error);
USHORT errorCode = error->GetErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u", errorCode);
OutputDebugStringA(buff);
if (SUCCEEDED(m_mediaEngine->GetError(&error)))
{
USHORT errorCode = error->GetErrorCode();
HRESULT hr = error->GetExtendedErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u (%08X)\n", errorCode, static_cast<unsigned int>(hr));
OutputDebugStringA(buff);
}
else
{
OutputDebugStringA("ERROR: Media Foundation Event Error *FAILED GetError*\n");
}
}
#endif
break;
Expand Down
17 changes: 12 additions & 5 deletions UWPSamples/Graphics/VideoTextureUWP12/MediaEnginePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,18 @@ void MediaEnginePlayer::OnMediaEngineEvent(uint32_t meEvent)
if (m_mediaEngine)
{
ComPtr<IMFMediaError> error;
m_mediaEngine->GetError(&error);
USHORT errorCode = error->GetErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u", errorCode);
OutputDebugStringA(buff);
if (SUCCEEDED(m_mediaEngine->GetError(&error)))
{
USHORT errorCode = error->GetErrorCode();
HRESULT hr = error->GetExtendedErrorCode();
char buff[128] = {};
sprintf_s(buff, "ERROR: Media Foundation Event Error %u (%08X)\n", errorCode, static_cast<unsigned int>(hr));
OutputDebugStringA(buff);
}
else
{
OutputDebugStringA("ERROR: Media Foundation Event Error *FAILED GetError*\n");
}
}
#endif
break;
Expand Down

0 comments on commit 4024860

Please sign in to comment.