vd_lavc: attempt to fallback from hwdec before anything is decoded

The previous commit moved the av_frame_unref() after the got_picture
check. This accidentally also deferred the software fallback
reinitialization to until a software picture was decoded (instead of the
exact time of the fallback), which is not ideal.

Just rely on the fact that calling av_frame_unref() on a frame is ok
even if nothing was decoded.
This commit is contained in:
wm4 2015-10-19 18:19:57 +02:00
parent 0ab6031d76
commit 50f8548b2f
1 changed files with 4 additions and 4 deletions

View File

@ -631,15 +631,15 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
return; return;
} }
// Skipped frame, or delayed output due to multithreaded decoding.
if (!got_picture)
return;
if (ctx->hwdec && ctx->hwdec_failed) { if (ctx->hwdec && ctx->hwdec_failed) {
av_frame_unref(ctx->pic); av_frame_unref(ctx->pic);
return; return;
} }
// Skipped frame, or delayed output due to multithreaded decoding.
if (!got_picture)
return;
struct mp_image_params params; struct mp_image_params params;
update_image_params(vd, ctx->pic, &params); update_image_params(vd, ctx->pic, &params);
vd->codec_pts = mp_pts_from_av(ctx->pic->pkt_pts, NULL); vd->codec_pts = mp_pts_from_av(ctx->pic->pkt_pts, NULL);