[Query] case when change pipe state
authorJaeyun Jung <jy1210.jung@samsung.com>
Tue, 18 Jun 2024 03:20:16 +0000 (12:20 +0900)
committerSangjung Woo <again4you@gmail.com>
Thu, 11 Jul 2024 09:30:38 +0000 (18:30 +0900)
Set caps in edge handle before calling change-state callback.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
gst/nnstreamer/tensor_query/tensor_query_serversink.c
gst/nnstreamer/tensor_query/tensor_query_serversrc.c

index 6f04b2b..a4fcaad 100644 (file)
@@ -181,6 +181,10 @@ gst_tensor_query_serversink_change_state (GstElement * element,
         nns_loge ("Failed to change state from PAUSED to PLAYING.");
         return GST_STATE_CHANGE_FAILURE;
       }
+
+      caps = gst_pad_peer_query_caps (GST_BASE_SINK_PAD (bsink), NULL);
+      gst_tensor_query_serversink_set_caps (bsink, caps);
+      gst_caps_unref (caps);
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       if (!_gst_tensor_query_serversink_start (sink)) {
@@ -202,10 +206,6 @@ gst_tensor_query_serversink_change_state (GstElement * element,
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
       gst_tensor_query_server_release_edge_handle (sink->sink_id);
       break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      caps = gst_pad_peer_query_caps (GST_BASE_SINK_PAD (bsink), NULL);
-      gst_tensor_query_serversink_set_caps(bsink, caps);
-      break;
     default:
       break;
   }
index e1b6994..71dc113 100644 (file)
@@ -286,6 +286,11 @@ gst_tensor_query_serversrc_change_state (GstElement * element,
         nns_loge ("Failed to change state from PAUSED to PLAYING.");
         return GST_STATE_CHANGE_FAILURE;
       }
+
+      caps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (bsrc), NULL);
+      gst_tensor_query_serversrc_set_caps (bsrc, caps);
+      gst_caps_unref (caps);
+
       src->playing = TRUE;
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
@@ -312,10 +317,6 @@ gst_tensor_query_serversrc_change_state (GstElement * element,
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       gst_tensor_query_server_remove_data (src->src_id);
       break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      caps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (bsrc), NULL);
-      gst_tensor_query_serversrc_set_caps (bsrc, caps);
-      break;
     default:
       break;
   }