mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
qmlglsink: fix another resize case
If qt asks us to redraw before we have both set a buffer and caps we would attempt to use the new caps with the old buffer which could result in bad things happening. Only update caps from new_caps once the buffer has actually been set. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1346>
This commit is contained in:
parent
a6fd767025
commit
55e04d129f
1 changed files with 13 additions and 13 deletions
|
@ -285,19 +285,6 @@ QtGLVideoItem::updatePaintNode(QSGNode * oldNode,
|
|||
|
||||
GST_TRACE ("%p updatePaintNode", this);
|
||||
|
||||
if (this->priv->new_caps) {
|
||||
GST_DEBUG ("%p caps change from %" GST_PTR_FORMAT " to %" GST_PTR_FORMAT,
|
||||
this, this->priv->caps, this->priv->new_caps);
|
||||
gst_caps_take (&this->priv->caps, this->priv->new_caps);
|
||||
this->priv->new_caps = NULL;
|
||||
this->priv->v_info = this->priv->new_v_info;
|
||||
|
||||
if (!_calculate_par (this, &this->priv->v_info)) {
|
||||
g_mutex_unlock (&this->priv->lock);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->priv->caps) {
|
||||
GST_LOG ("%p no caps yet", this);
|
||||
g_mutex_unlock (&this->priv->lock);
|
||||
|
@ -580,6 +567,19 @@ QtGLVideoItemInterface::setBuffer (GstBuffer * buffer)
|
|||
|
||||
g_mutex_lock (&qt_item->priv->lock);
|
||||
|
||||
if (qt_item->priv->new_caps) {
|
||||
GST_DEBUG ("%p caps change from %" GST_PTR_FORMAT " to %" GST_PTR_FORMAT,
|
||||
this, qt_item->priv->caps, qt_item->priv->new_caps);
|
||||
gst_caps_take (&qt_item->priv->caps, qt_item->priv->new_caps);
|
||||
qt_item->priv->new_caps = NULL;
|
||||
qt_item->priv->v_info = qt_item->priv->new_v_info;
|
||||
|
||||
if (!_calculate_par (qt_item, &qt_item->priv->v_info)) {
|
||||
g_mutex_unlock (&qt_item->priv->lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gst_buffer_replace (&qt_item->priv->buffer, buffer);
|
||||
|
||||
QMetaObject::invokeMethod(qt_item, "update", Qt::QueuedConnection);
|
||||
|
|
Loading…
Reference in a new issue