From fb8f7c25deecb1412417d2baa82ec4b36f834bcb Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 10 Sep 2018 23:21:52 +1000 Subject: sctpenc: start pad task after the parent has activated pads Fixes a race where the task could attempt to set stream-start/caps/segment before the pad was active and would be dropped resulting in a 'data-flow before stream-start' warning. --- ext/sctp/gstsctpenc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ext/sctp/gstsctpenc.c b/ext/sctp/gstsctpenc.c index 80a338f33..0ce411643 100644 --- a/ext/sctp/gstsctpenc.c +++ b/ext/sctp/gstsctpenc.c @@ -336,22 +336,16 @@ gst_sctp_enc_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_CHANGE_READY_TO_PAUSED: self->need_segment = self->need_stream_start_caps = TRUE; gst_data_queue_set_flushing (self->outbound_sctp_packet_queue, FALSE); - gst_pad_start_task (self->src_pad, - (GstTaskFunction) gst_sctp_enc_srcpad_loop, self->src_pad, NULL); res = configure_association (self); break; - 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; default: @@ -361,6 +355,23 @@ gst_sctp_enc_change_state (GstElement * element, GstStateChange transition) if (res) ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + gst_pad_start_task (self->src_pad, + (GstTaskFunction) gst_sctp_enc_srcpad_loop, self->src_pad, NULL); + break; + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_NULL: + break; + default: + break; + } + return ret; } -- cgit v1.2.3