mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Properly handle drain requests while flushing
Without this commit the decoder streaming thread stops without ever attending the drain request, leaving the decoder input thread waiting forever. https://bugzilla.gnome.org/show_bug.cgi?id=758274
This commit is contained in:
parent
9adf0ff829
commit
d1a79d7c59
4 changed files with 48 additions and 0 deletions
|
@ -599,9 +599,15 @@ component_error:
|
||||||
flushing:
|
flushing:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
|
||||||
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,8 +679,14 @@ flow_error:
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
}
|
}
|
||||||
GST_AUDIO_DECODER_STREAM_UNLOCK (self);
|
GST_AUDIO_DECODER_STREAM_UNLOCK (self);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -491,9 +491,15 @@ component_error:
|
||||||
flushing:
|
flushing:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_AUDIO_ENCODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_AUDIO_ENCODER_SRC_PAD (self));
|
||||||
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
eos:
|
eos:
|
||||||
|
@ -541,8 +547,14 @@ flow_error:
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_AUDIO_ENCODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_AUDIO_ENCODER_SRC_PAD (self));
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
}
|
}
|
||||||
GST_AUDIO_ENCODER_STREAM_UNLOCK (self);
|
GST_AUDIO_ENCODER_STREAM_UNLOCK (self);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1534,9 +1534,15 @@ component_error:
|
||||||
flushing:
|
flushing:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
|
||||||
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1594,8 +1600,14 @@ flow_error:
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
}
|
}
|
||||||
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
|
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -788,9 +788,15 @@ component_error:
|
||||||
flushing:
|
flushing:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
|
||||||
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
self->downstream_flow_ret = GST_FLOW_FLUSHING;
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,8 +845,14 @@ flow_error:
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
} else if (flow_ret == GST_FLOW_FLUSHING) {
|
||||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||||
|
g_mutex_lock (&self->drain_lock);
|
||||||
|
if (self->draining) {
|
||||||
|
self->draining = FALSE;
|
||||||
|
g_cond_broadcast (&self->drain_cond);
|
||||||
|
}
|
||||||
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
|
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
g_mutex_unlock (&self->drain_lock);
|
||||||
}
|
}
|
||||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
|
GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue