mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
core: pipeline: protect priv->is_live with object lock
It's supposed to be according to the comment where it's defined. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4472>
This commit is contained in:
parent
b8cb0d1d7f
commit
9dc4d48ff5
1 changed files with 10 additions and 2 deletions
|
@ -519,7 +519,9 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
GST_OBJECT_LOCK (element);
|
||||||
pipeline->priv->is_live = FALSE;
|
pipeline->priv->is_live = FALSE;
|
||||||
|
GST_OBJECT_UNLOCK (element);
|
||||||
reset_start_time (pipeline, 0);
|
reset_start_time (pipeline, 0);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
|
@ -529,9 +531,11 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
|
||||||
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||||
|
|
||||||
if (GST_STATE_TRANSITION_NEXT (transition) == GST_STATE_PAUSED) {
|
if (GST_STATE_TRANSITION_NEXT (transition) == GST_STATE_PAUSED) {
|
||||||
|
GST_OBJECT_LOCK (element);
|
||||||
pipeline->priv->is_live = result == GST_STATE_CHANGE_NO_PREROLL;
|
pipeline->priv->is_live = result == GST_STATE_CHANGE_NO_PREROLL;
|
||||||
GST_INFO_OBJECT (pipeline, "pipeline is%slive",
|
GST_INFO_OBJECT (pipeline, "pipeline is%slive",
|
||||||
pipeline->priv->is_live ? " " : " not ");
|
pipeline->priv->is_live ? " " : " not ");
|
||||||
|
GST_OBJECT_UNLOCK (element);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
|
@ -621,6 +625,7 @@ gst_pipeline_handle_message (GstBin * bin, GstMessage * message)
|
||||||
case GST_MESSAGE_RESET_TIME:
|
case GST_MESSAGE_RESET_TIME:
|
||||||
{
|
{
|
||||||
GstClockTime running_time;
|
GstClockTime running_time;
|
||||||
|
gboolean is_live;
|
||||||
|
|
||||||
gst_message_parse_reset_time (message, &running_time);
|
gst_message_parse_reset_time (message, &running_time);
|
||||||
|
|
||||||
|
@ -628,9 +633,12 @@ gst_pipeline_handle_message (GstBin * bin, GstMessage * message)
|
||||||
* children. */
|
* children. */
|
||||||
reset_start_time (pipeline, running_time);
|
reset_start_time (pipeline, running_time);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (pipeline);
|
||||||
|
is_live = pipeline->priv->is_live;
|
||||||
|
GST_OBJECT_UNLOCK (pipeline);
|
||||||
|
|
||||||
/* If we are live, sample a new base_time immediately */
|
/* If we are live, sample a new base_time immediately */
|
||||||
if (pipeline->priv->is_live
|
if (is_live && GST_STATE_TARGET (pipeline) == GST_STATE_PLAYING) {
|
||||||
&& GST_STATE_TARGET (pipeline) == GST_STATE_PLAYING) {
|
|
||||||
gst_pipeline_change_state (GST_ELEMENT (pipeline),
|
gst_pipeline_change_state (GST_ELEMENT (pipeline),
|
||||||
GST_STATE_CHANGE_PAUSED_TO_PLAYING);
|
GST_STATE_CHANGE_PAUSED_TO_PLAYING);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue