mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
interleave: handle EOS on all pads
When all pads go to EOS immediately, we are not negotiated and our collected function is called (without any available data). Handle this case gracefully. Conflicts: gst/interleave/interleave.c
This commit is contained in:
parent
e0636feff8
commit
01db5dbff0
1 changed files with 7 additions and 4 deletions
|
@ -1177,7 +1177,7 @@ static GstFlowReturn
|
||||||
gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
||||||
{
|
{
|
||||||
guint size;
|
guint size;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf = NULL;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GSList *collected;
|
GSList *collected;
|
||||||
guint nsamples;
|
guint nsamples;
|
||||||
|
@ -1186,13 +1186,15 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
||||||
gint width = self->width / 8;
|
gint width = self->width / 8;
|
||||||
GstMapInfo write_info;
|
GstMapInfo write_info;
|
||||||
|
|
||||||
|
size = gst_collect_pads_available (pads);
|
||||||
|
if (size == 0)
|
||||||
|
goto eos;
|
||||||
|
|
||||||
g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
|
g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
|
||||||
g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED);
|
g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED);
|
||||||
g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED);
|
g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED);
|
||||||
g_return_val_if_fail (self->rate > 0, GST_FLOW_NOT_NEGOTIATED);
|
g_return_val_if_fail (self->rate > 0, GST_FLOW_NOT_NEGOTIATED);
|
||||||
|
|
||||||
size = gst_collect_pads_available (pads);
|
|
||||||
|
|
||||||
g_return_val_if_fail (size % width == 0, GST_FLOW_ERROR);
|
g_return_val_if_fail (size % width == 0, GST_FLOW_ERROR);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Starting to collect %u bytes from %d channels", size,
|
GST_DEBUG_OBJECT (self, "Starting to collect %u bytes from %d channels", size,
|
||||||
|
@ -1281,7 +1283,8 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
||||||
eos:
|
eos:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (self, "no data available, must be EOS");
|
GST_DEBUG_OBJECT (self, "no data available, must be EOS");
|
||||||
gst_buffer_unref (outbuf);
|
if (outbuf)
|
||||||
|
gst_buffer_unref (outbuf);
|
||||||
gst_pad_push_event (self->src, gst_event_new_eos ());
|
gst_pad_push_event (self->src, gst_event_new_eos ());
|
||||||
return GST_FLOW_EOS;
|
return GST_FLOW_EOS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue