summaryrefslogtreecommitdiffstats
path: root/sys/oss/gstosssrc.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2003-01-27 20:23:55 +0000
committerWim Taymans <wim.taymans@gmail.com>2003-01-27 20:23:55 +0000
commitae07474bb234935041fbed9fa83e2d9dd92c3c91 (patch)
tree1e3580bca3db8fafed9e1d0025bc70c332850f95 /sys/oss/gstosssrc.c
parent0eb4d2208e9cac04034228ab54ac43ce0fc114cb (diff)
- Add error reporting
Original commit message from CVS: - Add error reporting - never return a NULL buffer
Diffstat (limited to 'sys/oss/gstosssrc.c')
-rw-r--r--sys/oss/gstosssrc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c
index eed94888..bf93e62f 100644
--- a/sys/oss/gstosssrc.c
+++ b/sys/oss/gstosssrc.c
@@ -25,7 +25,9 @@
#include <fcntl.h>
#include <sys/soundcard.h>
#include <sys/ioctl.h>
+#include <errno.h>
#include <unistd.h>
+#include <string.h>
#include <gstosssrc.h>
#include <gstosscommon.h>
@@ -258,22 +260,31 @@ gst_osssrc_get (GstPad *pad)
readbytes = read (src->common.fd,GST_BUFFER_DATA (buf),
src->buffersize);
+ if (readbytes < 0) {
+ gst_buffer_unref (buf);
+ gst_element_error (GST_ELEMENT (src), "error reading data (%s)",
+ strerror (errno));
+ return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));
+ }
if (readbytes == 0) {
+ gst_buffer_unref (buf);
gst_element_set_eos (GST_ELEMENT (src));
- return NULL;
+ return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));
}
if (!GST_PAD_CAPS (pad)) {
/* nothing was negotiated, we can decide on a format */
if (!gst_osssrc_negotiate (pad)) {
+ gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (src), "could not negotiate format");
- return NULL;
+ return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));
}
}
if (src->common.bps == 0) {
+ gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (src), "no format negotiated");
- return NULL;
+ return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));
}
GST_BUFFER_SIZE (buf) = readbytes;