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.
This commit is contained in:
Matthew Waters 2018-09-10 23:21:52 +10:00
parent 88b4ce9fc0
commit fb8f7c25de

View file

@ -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;
}