nice: Sync with libnice 0.1.22's 29/317929/2
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 9 Jan 2025 00:32:40 +0000 (09:32 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 10 Jan 2025 07:05:32 +0000 (16:05 +0900)
A patch has been applied from libnice.
 : d053572c49f1ff5c51740cf6bbc816aadc29087a - nicesink: Protect field access with object lock

Change-Id: I5bdd67921d2117188ce150a533d3efdb4e537f79
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
subprojects/gst-plugins-bad/ext/nice/gstnicesink.c

index ced4bd03ac0e93b94a031e1128fc8bc69728beb9..204d575d109050e96872c2e17685685ea50a54f6 100644 (file)
@@ -504,24 +504,23 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-      if (sink->agent == NULL)
-        {
-          GST_ERROR_OBJECT (element,
-              "Trying to start Nice sink without an agent set");
-          return GST_STATE_CHANGE_FAILURE;
-        }
-      else if (sink->stream_id == 0)
-          {
-            GST_ERROR_OBJECT (element,
-                "Trying to start Nice sink without a stream set");
-            return GST_STATE_CHANGE_FAILURE;
-          }
-      else if (sink->component_id == 0)
-          {
-            GST_ERROR_OBJECT (element,
-                "Trying to start Nice sink without a component set");
-            return GST_STATE_CHANGE_FAILURE;
-          }
+      GST_OBJECT_LOCK (element);
+      if (sink->agent == NULL) {
+        GST_ERROR_OBJECT (element,
+            "Trying to start Nice sink without an agent set");
+        goto failure;
+      }
+      else if (sink->stream_id == 0) {
+        GST_ERROR_OBJECT (element,
+            "Trying to start Nice sink without a stream set");
+        goto failure;
+      }
+      else if (sink->component_id == 0) {
+        GST_ERROR_OBJECT (element,
+            "Trying to start Nice sink without a component set");
+        goto failure;
+      }
+      GST_OBJECT_UNLOCK (element);
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@@ -536,6 +535,10 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
       transition);
 
   return ret;
+
+failure:
+  GST_OBJECT_UNLOCK (element);
+  return GST_STATE_CHANGE_FAILURE;
 }
 
 gboolean