diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c index 000c713739..63e4dd6ac5 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.c +++ b/gst-libs/gst/vaapi/gstvaapicontext.c @@ -323,6 +323,7 @@ gst_vaapi_context_init (GstVaapiContext * context, cip->chroma_type = DEFAULT_CHROMA_TYPE; context->va_config = VA_INVALID_ID; + context->reset_on_resize = TRUE; gst_vaapi_context_overlay_init (context); } @@ -425,7 +426,7 @@ gst_vaapi_context_reset (GstVaapiContext * context, if (context_update_config_encoder (context, &new_cip->config.encoder)) reset_config = TRUE; } else if (new_cip->usage == GST_VAAPI_CONTEXT_USAGE_DECODE) { - if (reset_surfaces || grow_surfaces) + if ((reset_surfaces && context->reset_on_resize) || grow_surfaces) reset_config = TRUE; } @@ -499,3 +500,20 @@ gst_vaapi_context_get_surface_count (GstVaapiContext * context) return gst_vaapi_video_pool_get_size (context->surfaces_pool); } + +/** + * gst_vaapi_context_reset_on_resize: + * @context: a #GstVaapiContext + * @reset_on_resize: Should the context be reset on size change + * + * Sets whether the underlying context should be reset when a size change + * happens. The proper setting for this is codec dependent. + */ +void +gst_vaapi_context_reset_on_resize (GstVaapiContext * context, + gboolean reset_on_resize) +{ + g_return_if_fail (context != NULL); + + context->reset_on_resize = reset_on_resize; +} diff --git a/gst-libs/gst/vaapi/gstvaapicontext.h b/gst-libs/gst/vaapi/gstvaapicontext.h index d3010c106b..19afc0626a 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.h +++ b/gst-libs/gst/vaapi/gstvaapicontext.h @@ -108,6 +108,7 @@ struct _GstVaapiContext GstVaapiVideoPool *surfaces_pool; GPtrArray *overlays[2]; guint overlay_id; + gboolean reset_on_resize; }; /** @@ -143,6 +144,11 @@ G_GNUC_INTERNAL guint gst_vaapi_context_get_surface_count (GstVaapiContext * context); +G_GNUC_INTERNAL +void +gst_vaapi_context_reset_on_resize (GstVaapiContext * context, + gboolean reset_on_resize); + G_END_DECLS #endif /* GST_VAAPI_CONTEXT_H */ diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c index a93154a54e..74f92d87f9 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c @@ -220,6 +220,9 @@ ensure_context (GstVaapiDecoderVp9 * decoder) if (!reset_context) return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; + + gst_vaapi_context_reset_on_resize (GST_VAAPI_DECODER_CONTEXT (decoder), + FALSE); } return GST_VAAPI_DECODER_STATUS_SUCCESS; }