mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
vulkan/hevc: handle missing active PPS
I don't pretend to understand how we get into this situation, but there are files out there where we can end up with the active PPS not being identified when we call vk_hevc_end_frame. In these situations today, we will segfault. So, before we give up, see if we can get the active PPS id from the slice header, and use that if possible. If that still doesn't work, return an error instead of segfaulting.
This commit is contained in:
parent
3b358f151d
commit
1c61c24f5f
@ -900,6 +900,7 @@ static int vk_hevc_end_frame(AVCodecContext *avctx)
|
||||
FFVulkanDecodePicture *vp = &hp->vp;
|
||||
FFVulkanDecodePicture *rvp[HEVC_MAX_REFS] = { 0 };
|
||||
AVFrame *rav[HEVC_MAX_REFS] = { 0 };
|
||||
int err;
|
||||
|
||||
if (!hp->h265_pic_info.sliceSegmentCount)
|
||||
return 0;
|
||||
@ -908,7 +909,19 @@ static int vk_hevc_end_frame(AVCodecContext *avctx)
|
||||
const HEVCSPS *sps = h->ps.sps;
|
||||
const HEVCPPS *pps = h->ps.pps;
|
||||
|
||||
int err = vk_hevc_create_params(avctx, &dec->session_params);
|
||||
if (!pps) {
|
||||
unsigned int pps_id = h->sh.pps_id;
|
||||
if (pps_id < HEVC_MAX_PPS_COUNT && h->ps.pps_list[pps_id] != NULL)
|
||||
pps = (const HEVCPPS *)h->ps.pps_list[pps_id]->data;
|
||||
}
|
||||
|
||||
if (!pps) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Encountered frame without a valid active PPS reference.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
err = vk_hevc_create_params(avctx, &dec->session_params);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user