diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2024-01-26 12:28:22 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2024-02-08 10:34:02 +0800 |
commit | cd31eac9997dc49b1d2b8de97b38c51ed8e9f4c9 (patch) | |
tree | 572f812d5f52ecf342f4c181552bcc4de9282f7c | |
parent | 82e8838165bba565912e6a00422f01329df32e18 (diff) | |
download | ffmpeg-cd31eac9997dc49b1d2b8de97b38c51ed8e9f4c9.tar.gz |
lavc/qsvenc: Add workaround for VP9 keyframe
The runtime doesn't set the frame type to MFX_FRAMETYPE_IDR on the
returned mfx bitstream for a keyframe, it set the frame type to
MFX_FRAMETYPE_I only. This patch added workaround for VP9 keyframe to
make the coded stream seekable.
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
-rw-r--r-- | libavcodec/qsvenc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a0144b0760..c63b72e384 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -2578,9 +2578,11 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, if (qpkt.bs->FrameType & MFX_FRAMETYPE_IDR || qpkt.bs->FrameType & MFX_FRAMETYPE_xIDR) { qpkt.pkt.flags |= AV_PKT_FLAG_KEY; pict_type = AV_PICTURE_TYPE_I; - } else if (qpkt.bs->FrameType & MFX_FRAMETYPE_I || qpkt.bs->FrameType & MFX_FRAMETYPE_xI) + } else if (qpkt.bs->FrameType & MFX_FRAMETYPE_I || qpkt.bs->FrameType & MFX_FRAMETYPE_xI) { + if (avctx->codec_id == AV_CODEC_ID_VP9) + qpkt.pkt.flags |= AV_PKT_FLAG_KEY; pict_type = AV_PICTURE_TYPE_I; - else if (qpkt.bs->FrameType & MFX_FRAMETYPE_P || qpkt.bs->FrameType & MFX_FRAMETYPE_xP) + } else if (qpkt.bs->FrameType & MFX_FRAMETYPE_P || qpkt.bs->FrameType & MFX_FRAMETYPE_xP) pict_type = AV_PICTURE_TYPE_P; else if (qpkt.bs->FrameType & MFX_FRAMETYPE_B || qpkt.bs->FrameType & MFX_FRAMETYPE_xB) pict_type = AV_PICTURE_TYPE_B; |