summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2018-09-10 23:21:52 +1000
committerMatthew Waters <matthew@centricular.com>2018-09-21 19:36:52 +1000
commitfb8f7c25deecb1412417d2baa82ec4b36f834bcb (patch)
tree1aa30a949299728e02c69cd87fe9e771d98bd099
parent88b4ce9fc07d388930b02ed814c82048ebce7640 (diff)
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.
-rw-r--r--ext/sctp/gstsctpenc.c23
1 files 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;
}