vc1: wait for bitstream recovery before starting decoding
This commit is contained in:
parent
46cb3743cb
commit
16ae6ba956
@ -397,6 +397,8 @@ typedef struct VC1Context{
|
||||
|
||||
int parse_only; ///< Context is used within parser
|
||||
int resync_marker; ///< could this stream contain resync markers
|
||||
|
||||
int recovered;
|
||||
} VC1Context;
|
||||
|
||||
/**
|
||||
|
@ -1054,6 +1054,13 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!v->recovered && !(avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) {
|
||||
if (s->pict_type == AV_PICTURE_TYPE_I)
|
||||
v->recovered = 1;
|
||||
else
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* skip B-frames if we don't have reference frames */
|
||||
if (!s->last_pic.ptr && s->pict_type == AV_PICTURE_TYPE_B) {
|
||||
av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n");
|
||||
@ -1392,6 +1399,14 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void vc1_decode_flush(AVCodecContext *avctx)
|
||||
{
|
||||
VC1Context *v = avctx->priv_data;
|
||||
|
||||
ff_mpeg_flush(avctx);
|
||||
|
||||
v->recovered = 0;
|
||||
}
|
||||
|
||||
const FFCodec ff_vc1_decoder = {
|
||||
.p.name = "vc1",
|
||||
@ -1402,7 +1417,7 @@ const FFCodec ff_vc1_decoder = {
|
||||
.init = vc1_decode_init,
|
||||
.close = ff_vc1_decode_end,
|
||||
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
||||
.flush = ff_mpeg_flush,
|
||||
.flush = vc1_decode_flush,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
||||
#if CONFIG_VC1_DXVA2_HWACCEL
|
||||
@ -1441,7 +1456,7 @@ const FFCodec ff_wmv3_decoder = {
|
||||
.init = vc1_decode_init,
|
||||
.close = ff_vc1_decode_end,
|
||||
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
||||
.flush = ff_mpeg_flush,
|
||||
.flush = vc1_decode_flush,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
||||
#if CONFIG_WMV3_DXVA2_HWACCEL
|
||||
|
Loading…
Reference in New Issue
Block a user