Skip to content

Commit

Permalink
Add surface null check (#5265)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuan, Pengxin <[email protected]>
  • Loading branch information
gfxVPLsdm and pengxin99 authored Jun 6, 2023
1 parent a912349 commit 8a5e77a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion _studio/shared/umc/io/umc_va/include/umc_va_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class LinuxVideoAccelerator : public VideoAccelerator
virtual VACompBuffer* GetCompBufferHW(int32_t type, int32_t size, int32_t index = -1);

// LinuxVideoAccelerator methods
uint16_t GetDecodingError();
uint16_t GetDecodingError(VASurfaceID *surface);

void SetTraceStrings(uint32_t umc_codec);
virtual Status SetAttributes(VAProfile va_profile, LinuxVideoAcceleratorParams* pParams, VAConfigAttrib *attribute, int32_t *attribsNumber);
Expand Down
38 changes: 18 additions & 20 deletions _studio/shared/umc/io/umc_va/src/umc_va_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ int32_t LinuxVideoAccelerator::GetSurfaceID(int32_t idx) const
return *surface;
}

uint16_t LinuxVideoAccelerator::GetDecodingError()
uint16_t LinuxVideoAccelerator::GetDecodingError(VASurfaceID *surface)
{
MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_EXTCALL, "GetDecodingError");
uint16_t error = 0;
Expand All @@ -931,29 +931,27 @@ uint16_t LinuxVideoAccelerator::GetDecodingError()
// NOTE: at the moment there is no such support for Android, so no need to execute...
VAStatus va_sts;

for(VASurfaceID surface : m_associatedIds)
VASurfaceDecodeMBErrors* pVaDecErr = NULL;
{
VASurfaceDecodeMBErrors* pVaDecErr = NULL;
{
PERF_UTILITY_AUTO("vaQuerySurfaceError", PERF_LEVEL_DDI);
va_sts = vaQuerySurfaceError(m_dpy, surface, VA_STATUS_ERROR_DECODING_ERROR, (void**)&pVaDecErr);
}
if (VA_STATUS_SUCCESS == va_sts)
PERF_UTILITY_AUTO("vaQuerySurfaceError", PERF_LEVEL_DDI);
MFX_CHECK(surface != nullptr, UMC_ERR_INVALID_PARAMS);
va_sts = vaQuerySurfaceError(m_dpy, *surface, VA_STATUS_ERROR_DECODING_ERROR, (void**)&pVaDecErr);
}
if (VA_STATUS_SUCCESS == va_sts)
{
if (NULL != pVaDecErr)
{
if (NULL != pVaDecErr)
for (int i = 0; pVaDecErr[i].status != -1; ++i)
{
for (int i = 0; pVaDecErr[i].status != -1; ++i)
{
{
error = MFX_CORRUPTION_MAJOR;
}

error = MFX_CORRUPTION_MAJOR;
}

}
else
{
error = MFX_CORRUPTION_MAJOR;
}
}
else
{
error = MFX_CORRUPTION_MAJOR;
}
}
#endif
Expand Down Expand Up @@ -1031,7 +1029,7 @@ Status LinuxVideoAccelerator::QueryTaskStatus(int32_t FrameBufIndex, void * stat
switch (va_sts)
{
case VA_STATUS_ERROR_DECODING_ERROR:
*(uint16_t*)error = GetDecodingError();
*(uint16_t*)error = GetDecodingError(surface);
break;

case VA_STATUS_ERROR_HW_BUSY:
Expand Down Expand Up @@ -1075,7 +1073,7 @@ Status LinuxVideoAccelerator::SyncTask(int32_t FrameBufIndex, void *surfCorrupti

if (VA_STATUS_ERROR_DECODING_ERROR == va_sts)
{
if (surfCorruption) *(uint16_t*)surfCorruption = GetDecodingError();
if (surfCorruption) *(uint16_t*)surfCorruption = GetDecodingError(surface);
return UMC_OK;
}
if (VA_STATUS_ERROR_OPERATION_FAILED == va_sts)
Expand Down

0 comments on commit 8a5e77a

Please sign in to comment.