Fixed the random crash associated with undecodable RASL pictures. (#141)
* * rocDecode/HEVC: Fixed the random crash associated with undecodable RASL pictures. - When a CRA picutre occurs, all the pictures in the DPB are emptied. However, the following RASL (Random Access Skipped Leading) picture can still reference these emptied pictures, making them undecodeble. - We initialized the reference picture lists with (0xFF), representing invalid picture index. Normally these invalid indices are replaced by valid values during RPS decoding. However, on undecodable RASL pictures, we can not find an existing reference picture in DPB, leaving the invalid index untouched and resulting invalid indexing later on. - Now we initialize the reference picture lists with a valid value 0. Also we add index range check on reference buffer at VA-API layer to avoid invalid memory access. * * rocDecode/HEVC: Fixed a typo in sampel app message.
This commit is contained in:
@@ -190,7 +190,7 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
VASurfaceID curr_surface_id;
|
||||
|
||||
// Get the surface id for the current picture, assuming 1:1 mapping between DPB and VAAPI decoded surfaces.
|
||||
if (pPicParams->CurrPicIdx >= va_surface_ids_.size()) {
|
||||
if (pPicParams->CurrPicIdx >= va_surface_ids_.size() || pPicParams->CurrPicIdx < 0) {
|
||||
ERR("CurrPicIdx exceeded the VAAPI surface pool limit.");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -202,6 +202,10 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
pPicParams->pic_params.hevc.cur_pic.PicIdx = curr_surface_id;
|
||||
for (int i = 0; i < 15; i++) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].PicIdx != 0xFF) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].PicIdx >= va_surface_ids_.size() || pPicParams->pic_params.hevc.ref_frames[i].PicIdx < 0) {
|
||||
ERR("Reference frame index exceeded the VAAPI surface pool limit.");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
pPicParams->pic_params.hevc.ref_frames[i].PicIdx = va_surface_ids_[pPicParams->pic_params.hevc.ref_frames[i].PicIdx];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user