1
0
Fork 0

dxva2_mpeg2: prevent calling end_frame without start_frame

This commit is contained in:
Hendrik Leppkes 2012-01-25 19:40:41 +01:00
parent 539b17963b
commit 6bbf5c05b1
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
1 changed files with 4 additions and 1 deletions

View File

@ -38,6 +38,7 @@ struct dxva2_picture_context {
const uint8_t *bitstream;
unsigned bitstream_size;
int frame_start;
};
void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx,
@ -272,6 +273,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
ctx_pic->slice_count = 0;
ctx_pic->bitstream_size = 0;
ctx_pic->bitstream = NULL;
ctx_pic->frame_start = 1;
return 0;
}
@ -305,8 +307,9 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
s->current_picture_ptr->hwaccel_picture_private;
int ret;
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0 || !ctx_pic->frame_start)
return -1;
ctx_pic->frame_start = 0;
ret = ff_dxva2_common_end_frame(avctx, s->current_picture_ptr->f,
&ctx_pic->pp, sizeof(ctx_pic->pp),
&ctx_pic->qm, sizeof(ctx_pic->qm),