diff options
author | Freyr <freyrnjordrson@gmail.com> | 2019-06-06 17:24:30 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-08-07 12:43:36 +0100 |
commit | 31b207eb879179022b9af7ced9627528192cab12 (patch) | |
tree | 0104b41c5c1fdffc78311f23b62d0b7549c5b0c7 | |
parent | 1785da2f086459a3513c4601c6798037dc5212f4 (diff) |
libs: encoder: vp8,vp9: reset frame_counter when input frame's format changes
When input frame's formate changes, vp{8,9} encoders don't reset their frame
counter, hence the newly created frame could become a P-frame, leading to some
major troubles (sigabrt in libdrm in case of vp9). This patch adds some frame
prediction-related reset logic to the `flush' methods of GstVaapiEncoderVP8 and
GstVaapiEncoderVP9 implementations.
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_vp8.c | 5 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_vp9.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c b/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c index 7ee0a2ef..0b8b3790 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c @@ -445,6 +445,11 @@ error: static GstVaapiEncoderStatus gst_vaapi_encoder_vp8_flush (GstVaapiEncoder * base_encoder) { + GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder); + + encoder->frame_num = 0; + clear_references (encoder); + return GST_VAAPI_ENCODER_STATUS_SUCCESS; } diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c index 94c9a5a6..4464f418 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c @@ -462,6 +462,10 @@ error: static GstVaapiEncoderStatus gst_vaapi_encoder_vp9_flush (GstVaapiEncoder * base_encoder) { + GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder); + + encoder->frame_num = 0; + return GST_VAAPI_ENCODER_STATUS_SUCCESS; } |