mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
decoder: create new context when encoded resolution changes.
Create a new VA context if the encoded surface size changes because we need to keep the underlying surface pool until the last one was released. Otherwise, either of the following cases could have happened: (i) release a VA surface to an inexistent pool, or (ii) release VA surface to an existing surface pool, but with different size.
This commit is contained in:
parent
eda01ab027
commit
9bba1e5fe3
1 changed files with 12 additions and 1 deletions
|
@ -818,8 +818,19 @@ gst_vaapi_decoder_ensure_context(
|
|||
)
|
||||
{
|
||||
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
||||
GstVideoCodecState * const codec_state = priv->codec_state;
|
||||
gboolean size_changed;
|
||||
|
||||
gst_vaapi_decoder_set_picture_size(decoder, cip->width, cip->height);
|
||||
size_changed = codec_state->info.width != cip->width ||
|
||||
codec_state->info.height != cip->height;
|
||||
|
||||
/* Create a new context if the requested size for surfaces changed
|
||||
* because we need to keep the context underlying surface pool
|
||||
* until all surfaces are released */
|
||||
if (size_changed) {
|
||||
gst_vaapi_decoder_set_picture_size(decoder, cip->width, cip->height);
|
||||
g_clear_object(&priv->context);
|
||||
}
|
||||
|
||||
if (priv->context) {
|
||||
if (!gst_vaapi_context_reset_full(priv->context, cip))
|
||||
|
|
Loading…
Reference in a new issue