gstvaapicontext: control reset_on_resize with option

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767474
This commit is contained in:
Scott D Phillips 2016-05-17 15:34:23 -07:00 committed by Víctor Manuel Jáquez Leal
parent b5bf2e83f7
commit ad9fcb9386
3 changed files with 28 additions and 1 deletions

View file

@ -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;
}

View file

@ -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 */

View file

@ -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;
}