aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-08-05 19:54:41 +0200
committerwm4 <nfxjfg@googlemail.com>2015-08-06 11:05:02 +0200
commit94c0df79c7e8205b9e0ae560bc4ac831c231abb8 (patch)
tree975bfc9e70b316768b59d4f008de22f16a8b393d /libavcodec/mpeg12dec.c
parentace837665362297a761ca92309ece8d7f4fa725a (diff)
downloadffmpeg-94c0df79c7e8205b9e0ae560bc4ac831c231abb8.tar.gz
lavc: propagate hwaccel errors
At least the new videotoolbox decoder does not actually set a frame if end_frame fails. This causes the API to return success and signals that a picture was decoded, even though AVFrame->data[0] is NULL. Fix this by propagating end_frame errors.
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1250d5343a..453cd6a80b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1723,9 +1723,11 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
if (s->avctx->hwaccel &&
(s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");
+ return ret;
+ }
}
for (i = 0; i < 4; i++) {
@@ -2082,9 +2084,12 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
return 0;
if (s->avctx->hwaccel) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ int ret = s->avctx->hwaccel->end_frame(s->avctx);
+ if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ return ret;
+ }
}
/* end of slice reached */