wtay gst-plugins-base: gst-plugins-base/ gst-plugins-base/tests/examples/app/

[email protected] Tue, 6 Jan 2009 02:50:52 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-base
Changes by:     wtay
Date:           Tue Jan 06 2009  10:50:52 UTC

Log message:
* tests/examples/app/appsrc_ex.c: (main):
Some comments.
When pulling a buffer we can get NULL when the element is EOS, don't try
to unref this NULL buffer.

Modified files:
    .               : ChangeLog
    tests/examples/app: appsrc_ex.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.4273&r2=1.4274
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/tests/examples/app/appsrc_ex.c.diff?r1=1.4&r2=1.5

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v
retrieving revision 1.4273
retrieving revision 1.4274
diff -u -d -r1.4273 -r1.4274
--- ChangeLog	6 Jan 2009 10:16:13 -0000	1.4273
+++ ChangeLog	6 Jan 2009 10:50:35 -0000	1.4274
@@ -1,3 +1,10 @@
+2009-01-06  Wim Taymans  <[email protected]>
+
+	* tests/examples/app/appsrc_ex.c: (main):
+	Some comments.
+	When pulling a buffer we can get NULL when the element is EOS, don't try
+	to unref this NULL buffer.
 2009-01-06  Jan Schmidt  <[email protected]>
 
 	* gst-libs/gst/video/Makefile.am:
Index: appsrc_ex.c
RCS file: /cvs/gstreamer/gst-plugins-base/tests/examples/app/appsrc_ex.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- appsrc_ex.c	5 Jun 2008 16:38:50 -0000	1.4
+++ appsrc_ex.c	6 Jan 2009 10:50:37 -0000	1.5
@@ -67,14 +67,20 @@
     gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);
   }
+  /* push EOS */
   gst_app_src_end_of_stream (GST_APP_SRC (app->src));
+  /* _is_eos() does not block and returns TRUE if there is not currently an EOS
+   * to be retrieved */
   while (!gst_app_sink_is_eos (GST_APP_SINK (app->sink))) {
     GstBuffer *buf;
+    /* pull the next item, this can return NULL when there is no more data and
+     * EOS has been received */
     buf = gst_app_sink_pull_buffer (GST_APP_SINK (app->sink));
     printf ("retrieved buffer %p\n", buf);
-    gst_buffer_unref (buf);
+    if (buf)
+      gst_buffer_unref (buf);
   gst_element_set_state (app->pipe, GST_STATE_NULL);

------------------------------------------------------------------------------