2 * Copyright (C) 2010 Wim Taymans <wim.taymans@gmail.com>
4 * gstbufferpool.c: GstBufferPool baseclass
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * SECTION:gstbufferpool
24 * @short_description: Pool for buffers
25 * @see_also: #GstBuffer
29 #include "gst_private.h"
35 #include <sys/types.h>
40 #include "gstbufferpool.h"
42 GST_DEBUG_CATEGORY_STATIC (gst_buffer_pool_debug);
43 #define GST_CAT_DEFAULT gst_buffer_pool_debug
45 #define GST_BUFFER_POOL_GET_PRIVATE(obj) \
46 (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BUFFER_POOL, GstBufferPoolPrivate))
48 #define GST_BUFFER_POOL_LOCK(pool) (g_static_rec_mutex_lock(&pool->priv->rec_lock))
49 #define GST_BUFFER_POOL_UNLOCK(pool) (g_static_rec_mutex_unlock(&pool->priv->rec_lock))
51 struct _GstBufferPoolPrivate
53 GStaticRecMutex rec_lock;
67 static void gst_buffer_pool_finalize (GObject * object);
69 G_DEFINE_TYPE (GstBufferPool, gst_buffer_pool, GST_TYPE_OBJECT);
71 static gboolean default_start (GstBufferPool * pool);
72 static gboolean default_stop (GstBufferPool * pool);
73 static gboolean default_set_config (GstBufferPool * pool,
74 GstStructure * config);
75 static GstFlowReturn default_alloc_buffer (GstBufferPool * pool,
76 GstBuffer ** buffer, GstBufferPoolParams * params);
77 static GstFlowReturn default_acquire_buffer (GstBufferPool * pool,
78 GstBuffer ** buffer, GstBufferPoolParams * params);
79 static void default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer,
80 GstBufferPoolParams * params);
81 static void default_free_buffer (GstBufferPool * pool, GstBuffer * buffer);
82 static void default_release_buffer (GstBufferPool * pool, GstBuffer * buffer);
85 gst_buffer_pool_class_init (GstBufferPoolClass * klass)
87 GObjectClass *gobject_class = (GObjectClass *) klass;
89 g_type_class_add_private (klass, sizeof (GstBufferPoolPrivate));
91 gobject_class->finalize = gst_buffer_pool_finalize;
93 klass->start = default_start;
94 klass->stop = default_stop;
95 klass->set_config = default_set_config;
96 klass->acquire_buffer = default_acquire_buffer;
97 klass->reset_buffer = default_reset_buffer;
98 klass->alloc_buffer = default_alloc_buffer;
99 klass->release_buffer = default_release_buffer;
100 klass->free_buffer = default_free_buffer;
102 GST_DEBUG_CATEGORY_INIT (gst_buffer_pool_debug, "bufferpool", 0,
107 gst_buffer_pool_init (GstBufferPool * pool)
109 pool->priv = GST_BUFFER_POOL_GET_PRIVATE (pool);
111 g_static_rec_mutex_init (&pool->priv->rec_lock);
113 pool->poll = gst_poll_new_timer ();
114 pool->queue = gst_atomic_queue_new (10);
115 pool->flushing = TRUE;
116 pool->active = FALSE;
117 pool->configured = FALSE;
118 pool->started = FALSE;
119 pool->config = gst_structure_id_empty_new (GST_QUARK (BUFFER_POOL_CONFIG));
120 gst_buffer_pool_config_set (pool->config, NULL, 0, 0, 0, 0, 1);
121 gst_poll_write_control (pool->poll);
123 GST_DEBUG_OBJECT (pool, "created");
127 gst_buffer_pool_finalize (GObject * object)
131 pool = GST_BUFFER_POOL_CAST (object);
133 GST_DEBUG_OBJECT (pool, "finalize");
135 gst_buffer_pool_set_active (pool, FALSE);
136 gst_atomic_queue_unref (pool->queue);
137 gst_poll_free (pool->poll);
138 gst_structure_free (pool->config);
139 g_static_rec_mutex_free (&pool->priv->rec_lock);
141 G_OBJECT_CLASS (gst_buffer_pool_parent_class)->finalize (object);
145 * gst_buffer_pool_new:
147 * Creates a new #GstBufferPool instance.
149 * Returns: a new #GstBufferPool instance
152 gst_buffer_pool_new (void)
154 GstBufferPool *result;
156 result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL);
157 GST_DEBUG_OBJECT (result, "created new buffer pool");
163 default_alloc_buffer (GstBufferPool * pool, GstBuffer ** buffer,
164 GstBufferPoolParams * params)
166 GstBufferPoolPrivate *priv = pool->priv;
169 *buffer = gst_buffer_new ();
171 mem = gst_allocator_alloc (NULL, priv->size + priv->prefix, priv->align);
172 gst_memory_resize (mem, priv->prefix, priv->size);
173 gst_buffer_take_memory (*buffer, -1, mem);
178 /* the default implementation for preallocating the buffers
181 default_start (GstBufferPool * pool)
184 GstBufferPoolPrivate *priv = pool->priv;
185 GstBufferPoolClass *pclass;
187 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
189 /* no alloc function, error */
190 if (G_UNLIKELY (pclass->alloc_buffer == NULL))
193 /* we need to prealloc buffers */
194 for (i = 0; i < priv->min_buffers; i++) {
197 if (pclass->alloc_buffer (pool, &buffer, NULL) != GST_FLOW_OK)
200 GST_LOG_OBJECT (pool, "prealloced buffer %d: %p", i, buffer);
201 /* release to the queue, we call the vmethod directly, we don't need to do
202 * the other refcount handling right now. */
203 if (G_LIKELY (pclass->release_buffer))
204 pclass->release_buffer (pool, buffer);
211 GST_WARNING_OBJECT (pool, "no alloc function");
216 GST_WARNING_OBJECT (pool, "alloc function failed");
221 /* must be called with the lock */
223 do_start (GstBufferPool * pool)
225 if (!pool->started) {
226 GstBufferPoolClass *pclass;
228 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
230 GST_LOG_OBJECT (pool, "starting");
231 /* start the pool, subclasses should allocate buffers and put them
233 if (G_LIKELY (pclass->start)) {
234 if (!pclass->start (pool))
237 pool->started = TRUE;
244 default_free_buffer (GstBufferPool * pool, GstBuffer * buffer)
246 gst_buffer_unref (buffer);
249 /* must be called with the lock */
251 default_stop (GstBufferPool * pool)
254 GstBufferPoolClass *pclass;
256 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
259 while ((buffer = gst_atomic_queue_pop (pool->queue))) {
260 GST_LOG_OBJECT (pool, "freeing %p", buffer);
261 gst_poll_read_control (pool->poll);
263 if (G_LIKELY (pclass->free_buffer))
264 pclass->free_buffer (pool, buffer);
269 /* must be called with the lock */
271 do_stop (GstBufferPool * pool)
274 GstBufferPoolClass *pclass;
276 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
278 GST_LOG_OBJECT (pool, "stopping");
279 if (G_LIKELY (pclass->stop)) {
280 if (!pclass->stop (pool))
283 pool->started = FALSE;
289 * gst_buffer_pool_set_active:
290 * @pool: a #GstBufferPool
291 * @active: the new active state
293 * Control the active state of @pool. When the pool is active, new calls to
294 * gst_buffer_pool_acquire_buffer() will return with GST_FLOW_WRONG_STATE.
296 * Returns: %FALSE when the pool was not configured or when preallocation of the
300 gst_buffer_pool_set_active (GstBufferPool * pool, gboolean active)
304 g_return_val_if_fail (GST_IS_BUFFER_POOL (pool), FALSE);
306 GST_LOG_OBJECT (pool, "active %d", active);
308 GST_BUFFER_POOL_LOCK (pool);
309 /* just return if we are already in the right state */
310 if (pool->active == active)
313 /* we need to be configured */
314 if (!pool->configured)
318 if (!do_start (pool))
321 /* unset the flushing state now */
322 gst_poll_read_control (pool->poll);
323 g_atomic_int_set (&pool->flushing, FALSE);
327 /* set to flushing first */
328 g_atomic_int_set (&pool->flushing, TRUE);
329 gst_poll_write_control (pool->poll);
331 /* when all buffers are in the pool, free them. Else they will be
332 * freed when they are released */
333 outstanding = g_atomic_int_get (&pool->outstanding);
334 GST_LOG_OBJECT (pool, "outstanding buffers %d", outstanding);
335 if (outstanding == 0) {
340 pool->active = active;
341 GST_BUFFER_POOL_UNLOCK (pool);
347 GST_DEBUG_OBJECT (pool, "pool was in the right state");
348 GST_BUFFER_POOL_UNLOCK (pool);
353 GST_ERROR_OBJECT (pool, "pool was not configured");
354 GST_BUFFER_POOL_UNLOCK (pool);
359 GST_ERROR_OBJECT (pool, "start failed");
360 GST_BUFFER_POOL_UNLOCK (pool);
365 GST_WARNING_OBJECT (pool, "stop failed");
366 GST_BUFFER_POOL_UNLOCK (pool);
372 default_set_config (GstBufferPool * pool, GstStructure * config)
374 GstBufferPoolPrivate *priv = pool->priv;
376 guint size, min_buffers, max_buffers;
379 /* parse the config and keep around */
380 if (!gst_buffer_pool_config_get (config, &caps, &size, &min_buffers,
381 &max_buffers, &prefix, &align))
384 GST_DEBUG_OBJECT (pool, "config %" GST_PTR_FORMAT, config);
387 priv->min_buffers = min_buffers;
388 priv->max_buffers = max_buffers;
389 priv->prefix = prefix;
396 GST_WARNING_OBJECT (pool, "invalid config %" GST_PTR_FORMAT, config);
402 * gst_buffer_pool_set_config:
403 * @pool: a #GstBufferPool
404 * @config: a #GstStructure
406 * Set the configuration of the pool. The pool must be inactive and all buffers
407 * allocated form this pool must be returned or else this function will do
408 * nothing and return FALSE.
410 * @config is a #GstStructure that contains the configuration parameters for
411 * the pool. A default and mandatory set of parameters can be configured with
412 * gst_buffer_pool_config_set(). This function takes ownership of @config.
414 * Returns: TRUE when the configuration could be set.
417 gst_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
420 GstBufferPoolClass *pclass;
422 g_return_val_if_fail (GST_IS_BUFFER_POOL (pool), FALSE);
423 g_return_val_if_fail (config != NULL, FALSE);
425 GST_BUFFER_POOL_LOCK (pool);
426 /* can't change the settings when active */
430 /* we can't change when outstanding buffers */
431 if (g_atomic_int_get (&pool->outstanding) != 0)
432 goto have_outstanding;
434 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
436 /* set the new config */
437 if (G_LIKELY (pclass->set_config))
438 result = pclass->set_config (pool, config);
444 gst_structure_free (pool->config);
445 pool->config = config;
447 /* now we are configured */
448 pool->configured = TRUE;
450 GST_BUFFER_POOL_UNLOCK (pool);
457 GST_WARNING_OBJECT (pool, "can't change config, we are active");
458 GST_BUFFER_POOL_UNLOCK (pool);
463 GST_WARNING_OBJECT (pool, "can't change config, have outstanding buffers");
464 GST_BUFFER_POOL_UNLOCK (pool);
470 * gst_buffer_pool_get_config:
471 * @pool: a #GstBufferPool
473 * Get a copy of the current configuration of the pool. This configuration
474 * can either be modified and used for the gst_buffer_pool_set_config() call
475 * or it must be freed after usage.
477 * Returns: a copy of the current configuration of @pool. use
478 * gst_structure_free() after usage or gst_buffer_pool_set_config().
481 gst_buffer_pool_get_config (GstBufferPool * pool)
483 GstStructure *result;
485 g_return_val_if_fail (GST_IS_BUFFER_POOL (pool), NULL);
487 GST_BUFFER_POOL_UNLOCK (pool);
488 result = gst_structure_copy (pool->config);
489 GST_BUFFER_POOL_UNLOCK (pool);
494 static const gchar *empty_meta[] = { NULL };
497 * gst_buffer_pool_get_metas:
498 * @pool: a #GstBufferPool
500 * Get a NULL terminated array of string with supported #GstMeta apis for
501 * @pool. The requested api would typically be added to the config with
502 * gst_buffer_pool_config_add_meta().
504 * Returns: a NULL terminated array of strings.
507 gst_buffer_pool_get_metas (GstBufferPool * pool)
509 GstBufferPoolClass *pclass;
510 const gchar **result;
512 g_return_val_if_fail (GST_IS_BUFFER_POOL (pool), NULL);
514 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
516 if (G_LIKELY (pclass->get_metas))
517 result = pclass->get_metas (pool);
525 * gst_buffer_pool_config_set:
526 * @config: a #GstBufferPool configuration
527 * @caps: caps for the buffers
528 * @size: the size of each buffer, not including prefix
529 * @min_buffers: the minimum amount of buffers to allocate.
530 * @max_buffers: the maximum amount of buffers to allocate or 0 for unlimited.
531 * @prefix: prefix each buffer with this many bytes
532 * @align: alignment of the buffer data.
534 * Configure @config with the given parameters.
537 gst_buffer_pool_config_set (GstStructure * config, const GstCaps * caps,
538 guint size, guint min_buffers, guint max_buffers, guint prefix, guint align)
540 g_return_if_fail (config != NULL);
542 gst_structure_id_set (config,
543 GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
544 GST_QUARK (SIZE), G_TYPE_UINT, size,
545 GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers,
546 GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers,
547 GST_QUARK (PREFIX), G_TYPE_UINT, prefix,
548 GST_QUARK (ALIGN), G_TYPE_UINT, align, NULL);
552 * gst_buffer_pool_config_add_meta:
553 * @config: a #GstBufferPool configuration
554 * @api: an API to add
556 * Adds the metadata api to @config. This will instruct the @bufferpool to use
557 * the specified metadata api on the buffers that it allocates.
559 * The supported API by @pool can be retrieved with gst_buffer_pool_get_metas().
562 gst_buffer_pool_config_add_meta (GstStructure * config, const gchar * api)
566 GValue api_value = { 0 };
568 g_return_if_fail (config != NULL);
570 value = gst_structure_id_get_value (config, GST_QUARK (META));
572 array = (GValueArray *) g_value_get_boxed (value);
574 GValue new_array_val = { 0, };
576 array = g_value_array_new (0);
578 g_value_init (&new_array_val, G_TYPE_VALUE_ARRAY);
579 g_value_take_boxed (&new_array_val, array);
581 gst_structure_id_take_value (config, GST_QUARK (META), &new_array_val);
584 g_value_init (&api_value, G_TYPE_STRING);
585 g_value_set_string (&api_value, api);
586 g_value_array_append (array, &api_value);
587 g_value_unset (&api_value);
591 * gst_buffer_pool_config_n_metas:
592 * @config: a #GstBufferPool configuration
594 * Retrieve the number of values currently stored in the
595 * meta API array of the @config structure.
597 * Returns: the metadata API array size as a #guint.
600 gst_buffer_pool_config_n_metas (GstStructure * config)
606 g_return_val_if_fail (config != NULL, 0);
608 value = gst_structure_id_get_value (config, GST_QUARK (META));
610 array = (GValueArray *) g_value_get_boxed (value);
611 size = array->n_values;
617 * gst_buffer_pool_config_get_meta:
618 * @config: a #GstBufferPool configuration
619 * @index: position in the metadata API array to read
621 * Parse an available @config and get the metadata API
622 * at @index of the metadata API array.
624 * Returns: a #gchar of the metadata API at @index.
627 gst_buffer_pool_config_get_meta (GstStructure * config, guint index)
630 const gchar *ret = NULL;
632 g_return_val_if_fail (config != NULL, 0);
634 value = gst_structure_id_get_value (config, GST_QUARK (META));
639 meta = (GValueArray *) g_value_get_boxed (value);
640 api_value = g_value_array_get_nth (meta, index);
643 ret = g_value_get_string (api_value);
649 * gst_buffer_pool_config_has_meta:
650 * @config: a #GstBufferPool configuration
651 * @api: a metadata api
653 * Check if @config contains @api metadata.
655 * Returns: TRUE if the metadata array contain @api.
658 gst_buffer_pool_config_has_meta (GstStructure * config, const gchar * api)
662 g_return_val_if_fail (config != NULL, 0);
664 value = gst_structure_id_get_value (config, GST_QUARK (META));
670 array = (GValueArray *) g_value_get_boxed (value);
671 for (i = 0; i < array->n_values; i++) {
672 api_value = g_value_array_get_nth (array, i);
673 if (!strcmp (api, g_value_get_string (api_value)))
681 * gst_buffer_pool_config_get:
682 * @config: a #GstBufferPool configuration
683 * @caps: the caps of buffers
684 * @size: the size of each buffer, not including prefix
685 * @min_buffers: the minimum amount of buffers to allocate.
686 * @max_buffers: the maximum amount of buffers to allocate or 0 for unlimited.
687 * @prefix: prefix each buffer with this many bytes
688 * @align: alignment of the buffer data.
690 * Get the configuration values from @config.
693 gst_buffer_pool_config_get (GstStructure * config, const GstCaps ** caps,
694 guint * size, guint * min_buffers, guint * max_buffers, guint * prefix,
697 g_return_val_if_fail (config != NULL, FALSE);
699 return gst_structure_id_get (config,
700 GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
701 GST_QUARK (SIZE), G_TYPE_UINT, size,
702 GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers,
703 GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers,
704 GST_QUARK (PREFIX), G_TYPE_UINT, prefix,
705 GST_QUARK (ALIGN), G_TYPE_UINT, align, NULL);
709 default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
710 GstBufferPoolParams * params)
712 GstFlowReturn result;
713 GstBufferPoolClass *pclass;
714 GstBufferPoolPrivate *priv = pool->priv;
716 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
719 if (G_UNLIKELY (g_atomic_int_get (&pool->flushing)))
722 /* try to get a buffer from the queue */
723 *buffer = gst_atomic_queue_pop (pool->queue);
724 if (G_LIKELY (*buffer)) {
725 gst_poll_read_control (pool->poll);
726 result = GST_FLOW_OK;
727 GST_LOG_OBJECT (pool, "acquired buffer %p", *buffer);
732 if (priv->max_buffers == 0) {
733 /* no max_buffers, we allocate some more */
734 if (G_LIKELY (pclass->alloc_buffer)) {
735 result = pclass->alloc_buffer (pool, buffer, params);
737 result = GST_FLOW_NOT_SUPPORTED;
738 GST_LOG_OBJECT (pool, "alloc buffer %p", *buffer);
742 /* check if we need to wait */
743 if (params && (params->flags & GST_BUFFER_POOL_FLAG_DONTWAIT)) {
744 GST_LOG_OBJECT (pool, "no more buffers");
745 result = GST_FLOW_UNEXPECTED;
750 GST_LOG_OBJECT (pool, "waiting for free buffers");
751 gst_poll_wait (pool->poll, GST_CLOCK_TIME_NONE);
759 GST_DEBUG_OBJECT (pool, "we are flushing");
760 return GST_FLOW_WRONG_STATE;
765 dec_outstanding (GstBufferPool * pool)
767 if (g_atomic_int_dec_and_test (&pool->outstanding)) {
768 /* all buffers are returned to the pool, see if we need to free them */
769 if (g_atomic_int_get (&pool->flushing)) {
770 /* take the lock so that set_active is not run concurrently */
771 GST_BUFFER_POOL_LOCK (pool);
772 /* recheck the flushing state in the lock, the pool could have been
773 * set to active again */
774 if (g_atomic_int_get (&pool->flushing))
777 GST_BUFFER_POOL_UNLOCK (pool);
783 default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer,
784 GstBufferPoolParams * params)
786 GST_BUFFER_FLAGS (buffer) = 0;
788 GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
789 GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
790 GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
791 GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
795 * gst_buffer_pool_acquire_buffer:
796 * @pool: a #GstBufferPool
797 * @buffer: a location for a #GstBuffer
798 * @params: parameters.
800 * Acquire a buffer from @pool. @buffer should point to a memory location that
801 * can hold a pointer to the new buffer.
803 * @params can be NULL or contain optional parameters to influence the allocation.
805 * Returns: a #GstFlowReturn such as GST_FLOW_WRONG_STATE when the pool is
809 gst_buffer_pool_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
810 GstBufferPoolParams * params)
812 GstBufferPoolClass *pclass;
813 GstFlowReturn result;
815 g_return_val_if_fail (GST_IS_BUFFER_POOL (pool), GST_FLOW_ERROR);
816 g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
818 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
820 /* assume we'll have one more outstanding buffer we need to do that so
821 * that concurrent set_active doesn't clear the buffers */
822 g_atomic_int_inc (&pool->outstanding);
824 if (G_LIKELY (pclass->acquire_buffer))
825 result = pclass->acquire_buffer (pool, buffer, params);
827 result = GST_FLOW_NOT_SUPPORTED;
829 if (G_LIKELY (result == GST_FLOW_OK)) {
830 /* all buffers from the pool point to the pool and have the refcount of the
831 * pool incremented */
832 (*buffer)->pool = gst_object_ref (pool);
833 /* now reset the buffer when needed */
834 if (G_LIKELY (pclass->reset_buffer))
835 pclass->reset_buffer (pool, *buffer, params);
837 dec_outstanding (pool);
844 default_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
846 /* keep it around in our queue */
847 GST_LOG_OBJECT (pool, "released buffer %p", buffer);
848 gst_atomic_queue_push (pool->queue, buffer);
849 gst_poll_write_control (pool->poll);
853 * gst_buffer_pool_release_buffer:
854 * @pool: a #GstBufferPool
855 * @buffer: a #GstBuffer
857 * Release @buffer to @pool. @buffer should have previously been allocated from
858 * @pool with gst_buffer_pool_acquire_buffer().
860 * This function is usually called automatically when the last ref on @buffer
864 gst_buffer_pool_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
866 GstBufferPoolClass *pclass;
868 g_return_if_fail (GST_IS_BUFFER_POOL (pool));
869 g_return_if_fail (buffer != NULL);
871 /* check that the buffer is ours, all buffers returned to the pool have the
872 * pool member set to NULL and the pool refcount decreased */
873 if (!g_atomic_pointer_compare_and_exchange ((gpointer *) & buffer->pool,
877 pclass = GST_BUFFER_POOL_GET_CLASS (pool);
879 if (G_LIKELY (pclass->release_buffer))
880 pclass->release_buffer (pool, buffer);
882 dec_outstanding (pool);
884 /* decrease the refcount that the buffer had to us */
885 gst_object_unref (pool);