mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
va: decoder: Delete all the internal locks
In fact, the va decoder is just a internal helper class and its access is under the control of all dec elements. So far, there is no parallel operation on it now. At the other side, some code scan tools report race condition issues. For example, the "context" field is just protected with lock at _open() but is not protected at _add_param_buffer(). So we just delete all its lock usage. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7547>
This commit is contained in:
parent
2652467d7c
commit
05353e69ca
1 changed files with 0 additions and 21 deletions
|
@ -212,9 +212,7 @@ gst_va_decoder_is_open (GstVaDecoder * self)
|
|||
|
||||
g_return_val_if_fail (GST_IS_VA_DECODER (self), FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
ret = (self->config != VA_INVALID_ID && self->profile != VAProfileNone);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -247,11 +245,9 @@ gst_va_decoder_open (GstVaDecoder * self, VAProfile profile, guint rt_format)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->config = config;
|
||||
self->profile = profile;
|
||||
self->rt_format = rt_format;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
/* now we should return now only this profile's caps */
|
||||
gst_caps_replace (&self->srcpad_caps, NULL);
|
||||
|
@ -284,9 +280,7 @@ gst_va_decoder_close (GstVaDecoder * self)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
gst_va_decoder_init (self);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
gst_caps_replace (&self->srcpad_caps, NULL);
|
||||
gst_caps_replace (&self->sinkpad_caps, NULL);
|
||||
|
@ -306,13 +300,10 @@ gst_va_decoder_set_frame_size_with_surfaces (GstVaDecoder * self,
|
|||
|
||||
g_return_val_if_fail (GST_IS_VA_DECODER (self), FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->context != VA_INVALID_ID) {
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_INFO_OBJECT (self, "decoder already has a context");
|
||||
return TRUE;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
if (!gst_va_decoder_is_open (self)) {
|
||||
GST_ERROR_OBJECT (self, "decoder has not been opened yet");
|
||||
|
@ -334,11 +325,9 @@ gst_va_decoder_set_frame_size_with_surfaces (GstVaDecoder * self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->context = context;
|
||||
self->coded_width = coded_width;
|
||||
self->coded_height = coded_height;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -364,19 +353,13 @@ gst_va_decoder_update_frame_size (GstVaDecoder * self, gint coded_width,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->context == VA_INVALID_ID) {
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_INFO_OBJECT (self, "decoder does not have a context");
|
||||
return FALSE;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->coded_width = coded_width;
|
||||
self->coded_height = coded_height;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -693,10 +676,8 @@ gst_va_decoder_config_is_equal (GstVaDecoder * self, VAProfile new_profile,
|
|||
|
||||
/* @TODO: Check if current buffers are large enough, and reuse
|
||||
* them */
|
||||
GST_OBJECT_LOCK (self);
|
||||
ret = (self->profile == new_profile && self->rt_format == new_rtformat
|
||||
&& self->coded_width == new_width && self->coded_height == new_height);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -710,7 +691,6 @@ gst_va_decoder_get_config (GstVaDecoder * self, VAProfile * profile,
|
|||
if (!gst_va_decoder_is_open (self))
|
||||
return FALSE;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (profile)
|
||||
*profile = self->profile;
|
||||
if (rt_format)
|
||||
|
@ -719,7 +699,6 @@ gst_va_decoder_get_config (GstVaDecoder * self, VAProfile * profile,
|
|||
*width = self->coded_width;
|
||||
if (height)
|
||||
*height = self->coded_height;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue