mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +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)
|
||||
{
|
||||
guint size;
|
||||
GstBuffer *outbuf;
|
||||
GstBuffer *outbuf = NULL;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GSList *collected;
|
||||
guint nsamples;
|
||||
|
@ -1186,13 +1186,15 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
|||
gint width = self->width / 8;
|
||||
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->width > 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);
|
||||
|
||||
size = gst_collect_pads_available (pads);
|
||||
|
||||
g_return_val_if_fail (size % width == 0, GST_FLOW_ERROR);
|
||||
|
||||
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:
|
||||
{
|
||||
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 ());
|
||||
return GST_FLOW_EOS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue