From 63a4cb67c2b71d302835067173b18b92f78dac40 Mon Sep 17 00:00:00 2001 From: Christian Schaller Date: Thu, 28 Nov 2002 14:13:51 +0000 Subject: [PATCH] commit the fdsrc fix from Pedro Corte-Real Original commit message from CVS: commit the fdsrc fix from Pedro Corte-Real --- gst/elements/gstfdsrc.c | 6 ++++++ plugins/elements/gstfdsrc.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index 56782e824e..f36d1c2fc2 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -191,6 +191,12 @@ gst_fdsrc_get(GstPad *pad) return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } + if (readbytes == -1) { + g_error ("Error reading from file descriptor. Ending stream.\n"); + gst_element_set_eos (GST_ELEMENT (src)); + return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); + } + GST_BUFFER_OFFSET (buf) = src->curoffset; GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 56782e824e..f36d1c2fc2 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -191,6 +191,12 @@ gst_fdsrc_get(GstPad *pad) return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } + if (readbytes == -1) { + g_error ("Error reading from file descriptor. Ending stream.\n"); + gst_element_set_eos (GST_ELEMENT (src)); + return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); + } + GST_BUFFER_OFFSET (buf) = src->curoffset; GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;