mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
dtlsenc: Handle pad activity states properly
This commit is contained in:
parent
ff01df1093
commit
4fed95c534
2 changed files with 30 additions and 41 deletions
|
@ -368,6 +368,7 @@ src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
|
|||
if (active) {
|
||||
GST_DEBUG_OBJECT (self, "src pad activating in push mode");
|
||||
|
||||
self->flushing = FALSE;
|
||||
self->send_initial_events = TRUE;
|
||||
success =
|
||||
gst_pad_start_task (pad, (GstTaskFunction) src_task_loop, self->src,
|
||||
|
@ -379,7 +380,7 @@ src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
|
|||
GST_DEBUG_OBJECT (self, "deactivating src pad");
|
||||
|
||||
g_mutex_lock (&self->queue_lock);
|
||||
GST_PAD_MODE (pad) = GST_PAD_MODE_NONE;
|
||||
self->flushing = TRUE;
|
||||
g_cond_signal (&self->queue_cond_add);
|
||||
g_mutex_unlock (&self->queue_lock);
|
||||
success = gst_pad_stop_task (pad);
|
||||
|
@ -396,14 +397,14 @@ src_task_loop (GstPad * pad)
|
|||
{
|
||||
GstDtlsEnc *self = GST_DTLS_ENC (GST_PAD_PARENT (pad));
|
||||
GstFlowReturn ret;
|
||||
GstPad *peer;
|
||||
gboolean peer_is_active;
|
||||
GstBuffer *buffer;
|
||||
gboolean start_connection_timeout = FALSE;
|
||||
|
||||
GST_TRACE_OBJECT (self, "src loop: acquiring lock");
|
||||
g_mutex_lock (&self->queue_lock);
|
||||
GST_TRACE_OBJECT (self, "src loop: acquired lock");
|
||||
|
||||
if (!gst_pad_is_active (pad)) {
|
||||
if (self->flushing) {
|
||||
GST_LOG_OBJECT (self, "src task loop entered on inactive pad");
|
||||
GST_TRACE_OBJECT (self, "src loop: releasing lock");
|
||||
g_mutex_unlock (&self->queue_lock);
|
||||
|
@ -415,7 +416,7 @@ src_task_loop (GstPad * pad)
|
|||
g_cond_wait (&self->queue_cond_add, &self->queue_lock);
|
||||
GST_TRACE_OBJECT (self, "src loop: add signaled");
|
||||
|
||||
if (!gst_pad_is_active (pad)) {
|
||||
if (self->flushing) {
|
||||
GST_LOG_OBJECT (self, "pad inactive, task returning");
|
||||
GST_TRACE_OBJECT (self, "src loop: releasing lock");
|
||||
g_mutex_unlock (&self->queue_lock);
|
||||
|
@ -424,14 +425,6 @@ src_task_loop (GstPad * pad)
|
|||
}
|
||||
GST_TRACE_OBJECT (self, "src loop: queue has element");
|
||||
|
||||
peer = gst_pad_get_peer (pad);
|
||||
peer_is_active = gst_pad_is_active (peer);
|
||||
gst_object_unref (peer);
|
||||
|
||||
if (peer_is_active) {
|
||||
GstBuffer *buffer;
|
||||
gboolean start_connection_timeout = FALSE;
|
||||
|
||||
buffer = g_queue_pop_head (&self->queue);
|
||||
g_mutex_unlock (&self->queue_lock);
|
||||
|
||||
|
@ -462,11 +455,6 @@ src_task_loop (GstPad * pad)
|
|||
GST_WARNING_OBJECT (self, "failed to push buffer on src pad: %s",
|
||||
gst_flow_get_name (ret));
|
||||
}
|
||||
} else {
|
||||
g_mutex_unlock (&self->queue_lock);
|
||||
g_warn_if_reached ();
|
||||
GST_TRACE_OBJECT (self, "src loop: releasing lock");
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -50,6 +50,7 @@ struct _GstDtlsEnc {
|
|||
GQueue queue;
|
||||
GMutex queue_lock;
|
||||
GCond queue_cond_add;
|
||||
gboolean flushing;
|
||||
|
||||
GstDtlsConnection *connection;
|
||||
gchar *connection_id;
|
||||
|
|
Loading…
Reference in a new issue