vd_lavc: return proper error codes from get_buffer2 callback

-1 is essentially random and usually the same as AVERROR(EPERM).
This commit is contained in:
wm4 2017-01-11 08:26:32 +01:00
parent c000b37e9a
commit ee66efeb99
1 changed files with 2 additions and 2 deletions

View File

@ -739,11 +739,11 @@ static int get_buffer2_hwdec(AVCodecContext *avctx, AVFrame *pic, int flags)
int h = pic->height;
if (imgfmt != ctx->hwdec_fmt && w != ctx->hwdec_w && h != ctx->hwdec_h)
return -1;
return AVERROR(EINVAL);
struct mp_image *mpi = ctx->hwdec->allocate_image(ctx, w, h);
if (!mpi)
return -1;
return AVERROR(ENOMEM);
for (int i = 0; i < 4; i++) {
pic->data[i] = mpi->planes[i];