[gst-cvs] gstreamer: fdsrc: cleanup parameter initialisation and add comemnt+logging

Stefan Kost ensonic at kemper.freedesktop.org
Wed Feb 17 01:33:52 PST 2010


Module: gstreamer
Branch: master
Commit: 3c2abf55819441e0f65ec9f44e06b4dd7cb61217
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=3c2abf55819441e0f65ec9f44e06b4dd7cb61217

Author: Stefan Kost <ensonic at users.sf.net>
Date:   Wed Feb 17 11:31:07 2010 +0200

fdsrc: cleanup parameter initialisation and add comemnt+logging

Initialize new_fd with DEFAULT_FD and fd with -1. Setting the property will set
new_fd and in _update_fd() we cehck fd against -1. Also add a coment about the
warning we get in the log from gst_poll_remove_fd(). We could get rid of the
warning if we want by tracking if fd has been added to fdset.

---

 plugins/elements/gstfdsrc.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c
index fee6901..0683a2c 100644
--- a/plugins/elements/gstfdsrc.c
+++ b/plugins/elements/gstfdsrc.c
@@ -204,9 +204,9 @@ gst_fd_src_class_init (GstFdSrcClass * klass)
 static void
 gst_fd_src_init (GstFdSrc * fdsrc, GstFdSrcClass * klass)
 {
-  fdsrc->new_fd = 0;
+  fdsrc->new_fd = DEFAULT_FD;
   fdsrc->seekable_fd = FALSE;
-  fdsrc->fd = DEFAULT_FD;
+  fdsrc->fd = -1;
   fdsrc->timeout = DEFAULT_TIMEOUT;
   fdsrc->uri = g_strdup_printf ("fd://0");
   fdsrc->curoffset = 0;
@@ -228,6 +228,9 @@ gst_fd_src_update_fd (GstFdSrc * src)
 {
   struct stat stat_results;
 
+  GST_DEBUG_OBJECT (src, "fdset %p, old_fd %d, new_fd %d", src->fdset, src->fd,
+      src->new_fd);
+
   /* we need to always update the fdset since it may not have existed when
    * gst_fd_src_update_fd () was called earlier */
   if (src->fdset != NULL) {
@@ -235,6 +238,7 @@ gst_fd_src_update_fd (GstFdSrc * src)
 
     if (src->fd >= 0) {
       fd.fd = src->fd;
+      /* this will log a harmless warning, if it was never added */
       gst_poll_remove_fd (src->fdset, &fd);
     }
 





More information about the Gstreamer-commits mailing list