diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2009-01-06 10:50:37 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2009-01-06 10:50:37 +0000 |
commit | 15583abf2508308f3e40149aeb8ba54e2bbc8166 (patch) | |
tree | 1f3613c11040654f94cea868f28abef8cd0493cc /tests | |
parent | 1b2dc5f3a855c19f2d39be53d1c486725426a236 (diff) |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/app/appsrc_ex.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/examples/app/appsrc_ex.c b/tests/examples/app/appsrc_ex.c index bc629fb01..c7aa4b6c8 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); |