summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2020-10-30 22:52:18 +1100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-10-31 01:47:06 +0000
commitdbeb5765318ed973376c2b595912e954fc2597d9 (patch)
tree9b46d2691375bd601eee5b48d02ef1a668bdc251 /ext
parent760592a29cebbaec3a3d20fabe4bf0220d84b2ad (diff)
downloadgstreamer-plugins-bad-dbeb5765318ed973376c2b595912e954fc2597d9.tar.gz
sctp: Do downward state change logic after chaining up.
Call the parent state_change function first when changing state downward, to make sure that the element has stopped before cleaning it up. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1741>
Diffstat (limited to 'ext')
-rw-r--r--ext/sctp/gstsctpdec.c15
-rw-r--r--ext/sctp/gstsctpenc.c3
2 files changed, 13 insertions, 5 deletions
diff --git a/ext/sctp/gstsctpdec.c b/ext/sctp/gstsctpdec.c
index ab242ade7..c9f6d0827 100644
--- a/ext/sctp/gstsctpdec.c
+++ b/ext/sctp/gstsctpdec.c
@@ -299,8 +299,7 @@ gst_sctp_dec_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- sctpdec_cleanup (self);
- gst_flow_combiner_reset (self->flow_combiner);
+ stop_all_srcpad_tasks (self);
break;
default:
break;
@@ -309,6 +308,15 @@ gst_sctp_dec_change_state (GstElement * element, GstStateChange transition)
if (ret != GST_STATE_CHANGE_FAILURE)
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+ switch (transition) {
+ case GST_STATE_CHANGE_PAUSED_TO_READY:
+ sctpdec_cleanup (self);
+ gst_flow_combiner_reset (self->flow_combiner);
+ break;
+ default:
+ break;
+ }
+
return ret;
}
@@ -424,7 +432,7 @@ gst_sctp_data_srcpad_loop (GstPad * pad)
GST_OBJECT_UNLOCK (self);
if (G_UNLIKELY (flow_ret == GST_FLOW_FLUSHING
- || flow_ret == GST_FLOW_NOT_LINKED)) {
+ || flow_ret == GST_FLOW_NOT_LINKED) || flow_ret == GST_FLOW_EOS) {
GST_DEBUG_OBJECT (pad, "Push failed on packet source pad. Error: %s",
gst_flow_get_name (flow_ret));
} else if (G_UNLIKELY (flow_ret != GST_FLOW_OK)) {
@@ -705,7 +713,6 @@ sctpdec_cleanup (GstSctpDec * self)
NULL, NULL);
g_signal_handler_disconnect (self->sctp_association,
self->signal_handler_stream_reset);
- stop_all_srcpad_tasks (self);
gst_sctp_association_force_close (self->sctp_association);
g_object_unref (self->sctp_association);
self->sctp_association = NULL;
diff --git a/ext/sctp/gstsctpenc.c b/ext/sctp/gstsctpenc.c
index ec0767d1e..41590b9fc 100644
--- a/ext/sctp/gstsctpenc.c
+++ b/ext/sctp/gstsctpenc.c
@@ -346,7 +346,7 @@ gst_sctp_enc_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- sctpenc_cleanup (self);
+ stop_srcpad_task (self->src_pad, self);
self->src_ret = GST_FLOW_FLUSHING;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
@@ -368,6 +368,7 @@ gst_sctp_enc_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
+ sctpenc_cleanup (self);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;