From 15583abf2508308f3e40149aeb8ba54e2bbc8166 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 6 Jan 2009 10:50:37 +0000 Subject: [PATCH] tests/examples/app/appsrc_ex.c: Some comments. Original commit message from CVS: * 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. --- ChangeLog | 7 +++++++ tests/examples/app/appsrc_ex.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ea5de54..876fbcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-06 Wim Taymans + + * 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 * gst-libs/gst/video/Makefile.am: diff --git a/tests/examples/app/appsrc_ex.c b/tests/examples/app/appsrc_ex.c index bc629fb..c7aa4b6 100644 --- a/tests/examples/app/appsrc_ex.c +++ b/tests/examples/app/appsrc_ex.c @@ -67,14 +67,20 @@ main (int argc, char *argv[]) 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); -- 2.7.4