summaryrefslogtreecommitdiff
path: root/gst/interleave
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-04-30 11:00:19 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-05-01 13:35:56 +0200
commit01db5dbff0aa8d2a60c9b2de585831a205b19508 (patch)
tree7700a37afe04887953b241ea37cb952b8697b1cc /gst/interleave
parente0636feff8055b37e9d7141e14683744dc4c7ac3 (diff)
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
Diffstat (limited to 'gst/interleave')
-rw-r--r--gst/interleave/interleave.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c
index 703f69a84..8174b1a9d 100644
--- a/gst/interleave/interleave.c
+++ b/gst/interleave/interleave.c
@@ -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;
}