summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-23 20:37:47 +0200
committerwm4 <wm4@nowhere>2015-09-23 20:37:47 +0200
commit009dfbe3b667b408094acd63b6e052ab8ba5870d (patch)
tree8885100e33a71db66fadf94d97dcf430be571c24 /video/decode/vd_lavc.c
parent2ed9370bd69806685ae18897831dac6ab90f5ea5 (diff)
downloadmpv-009dfbe3b667b408094acd63b6e052ab8ba5870d.tar.bz2
mpv-009dfbe3b667b408094acd63b6e052ab8ba5870d.tar.xz
vd_lavc: do not abort hardware decoding on errors
Usually, libavcodec ignores errors reported by the hardware decoding API, so it's not like we can actually escape if the hardware is somehow acting up. For normal fallback purposes, or if parts of the hw decoding API which we actually check fails, we do this by setting and checking the hwdec_failed flag anyway.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 375014e541..3d29a9c7d9 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -602,8 +602,8 @@ static int get_buffer2_hwdec(AVCodecContext *avctx, AVFrame *pic, int flags)
return 0;
}
-static int decode(struct dec_video *vd, struct demux_packet *packet,
- int flags, struct mp_image **out_image)
+static void decode(struct dec_video *vd, struct demux_packet *packet,
+ int flags, struct mp_image **out_image)
{
int got_picture = 0;
int ret;
@@ -629,7 +629,7 @@ static int decode(struct dec_video *vd, struct demux_packet *packet,
if (ctx->hwdec_failed || ret < 0) {
if (ret < 0)
MP_WARN(vd, "Error while decoding frame!\n");
- return -1;
+ return;
}
if (ctx->hwdec_request_reinit)
@@ -637,7 +637,7 @@ static int decode(struct dec_video *vd, struct demux_packet *packet,
// Skipped frame, or delayed output due to multithreaded decoding.
if (!got_picture)
- return 0;
+ return;
struct mp_image_params params;
update_image_params(vd, ctx->pic, &params);
@@ -647,7 +647,7 @@ static int decode(struct dec_video *vd, struct demux_packet *packet,
struct mp_image *mpi = mp_image_from_av_frame(ctx->pic);
av_frame_unref(ctx->pic);
if (!mpi)
- return 0; // mpi==NULL, or OOM
+ return;
assert(mpi->planes[0] || mpi->planes[3]);
mp_image_set_params(mpi, &params);
@@ -655,7 +655,6 @@ static int decode(struct dec_video *vd, struct demux_packet *packet,
mpi = ctx->hwdec->process_image(ctx, mpi);
*out_image = mp_img_swap_to_native(mpi);
- return 1;
}
static struct mp_image *decode_with_fallback(struct dec_video *vd,
@@ -666,8 +665,8 @@ static struct mp_image *decode_with_fallback(struct dec_video *vd,
return NULL;
struct mp_image *mpi = NULL;
- int res = decode(vd, packet, flags, &mpi);
- if (res < 0) {
+ decode(vd, packet, flags, &mpi);
+ if (ctx->hwdec_failed) {
// Failed hardware decoding? Try again in software.
if (force_fallback(vd) && ctx->avctx)
decode(vd, packet, flags, &mpi);