Commit graph

289 commits

Author SHA1 Message Date
Tim-Philipp Müller
5889260d5a Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
2011-12-04 13:35:38 +00:00
Tim-Philipp Müller
2f8ac67726 queue: use statically allocated GQueue 2011-11-03 23:08:52 +00:00
Ole André Vadla Ravnås
037efe8738 elements: Fix pad callbacks so they handle when parent goes away
1) We need to lock and get a strong ref to the parent, if still there.
2) If it has gone away, we need to handle that gracefully.

This is necessary in order to safely modify a running pipeline. Has been
observed when a streaming thread is doing a buffer_alloc() while an
application thread sends an event on a pad further downstream, and from
within a pad probe (holding STREAM_LOCK) carries out the pipeline plumbing
while the streaming thread has its buffer_alloc() in progress.
2011-04-13 17:41:17 +02:00
Havard Graff
d092e3b9ff queue[2]: Make src query MT-safe
It is possible that the element might be going down while the event arrives
2011-04-08 14:58:51 +02:00
Sebastian Dröge
1dac816e9c queue[2]: Unref events if the parent element disappeared 2011-04-08 14:57:18 +02:00
Havard Graff
d5485786a4 queue[2]: Make upstream events MT-safe 2011-04-08 14:57:05 +02:00
Stian Selnes
339df347a0 gstqueue, gstqueue2: check if parent of pad is NULL in _getcaps
Parent of the pad (the queue) may be set to NULL while there is
a buffer alloc going on.
2011-04-08 14:51:06 +02:00
Tim-Philipp Müller
8a7fc1d8c9 Revert "micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers"
This reverts commit 6aa8ca37ee.

See http://article.gmane.org/gmane.comp.video.gstreamer.devel/32282
2010-12-26 21:21:43 +00:00
Edward Hervey
6aa8ca37ee micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers 2010-12-03 12:03:42 +01:00
Edward Hervey
0c2086a475 queue: Remove useless checks from e406f7
srcresult was being rechecked in places it couldn't have changed.
queue level was being rechecked in places it couldn't have changed.

https://bugzilla.gnome.org/show_bug.cgi?id=632780
2010-12-02 19:04:56 +01:00
Wim Taymans
aa62c60a6c queue: avoid g_cond_signal when we can
Keep track of what cond we are waiting on and only signal when some other thread
is waiting.
2010-10-12 18:48:10 +02:00
Wim Taymans
85a23c6f80 queue: add debug statement 2010-10-11 16:45:40 +02:00
Ognyan Tonchev
36b533d5b2 queue: apply sink segment on the source if queue is empty
Apply the sink segment on the source immediatly when it is received
and there is nothing in the queue.

Solves #482147
2010-10-11 15:56:31 +02:00
Stefan Kost
e406f7c572 queue: add silent property to suppress signal emission
Allow to turn off signal emission and therefore extra locking if this is not needed.
Fixes #621299
2010-08-30 09:46:53 +03:00
Sebastian Dröge
2e6f80bf81 elements: Stop using GST_FLOW_IS_FATAL() 2010-08-27 16:59:09 +02:00
Stefan Kost
23337eabf9 queue: ARG_ -> PROP_ for property constants 2010-08-27 16:31:55 +03:00
Jonas Holmberg
97cab76ca7 queue: Push newsegment when linking in PLAYING
Fixes #611918
2010-08-20 16:11:41 +02:00
Edward Hervey
4452672001 queue: Register debug funcptr only once.
Makes creating queue elements 3-4 times faster and avoids contention on the
global funcptr lock.
2009-12-01 19:29:25 +01:00
Tim-Philipp Müller
daecaf0e8a Remove GST_DEBUG_FUNCPTR where they're pointless
There's not much point in using GST_DEBUG_FUNCPTR with GObject
virtual functions such as get_property, set_propery, finalize and
dispose, since they'll never be used by anyone anyway. Saves a
few bytes and possibly a tenth of a polar bear.
2009-10-28 00:44:24 +00:00
Stefan Kost
9f9353a84a queue: more queue optimizations
Split gst_queue_locked_enqueue() into variant for buffer and event to get rid of
the if() and make the code more readable (constant boolean parameters are never
nice). Removes the if (item) checks as we dereference the pointer before anyway.

Also apply the same idea of reusing the previous knowledge in
gst_queue_locked_dequeue to remove more type checks.
2009-10-08 10:54:42 +03:00
Edward Hervey
d28a3e7435 plugins/queue: Use previous knowledge of data type to avoid typecheck.
We know whether we have a buffer or an event, use that instead of going
trough the expensive GLib typecheck.

The overall instruction fetch reduction introduced by this commit and the
2 previous commits:
* receiving a buffer (_chain) by 20%
* popping a buffer (_loop) by 14%

Numbers acquired through callgrind passing 100000 buffers through queue.
2009-10-07 09:15:13 +02:00
Edward Hervey
9be7fdc857 plugins/queue: Avoid useless segment_to_running_time() calculations.
* Cache src and sink time
* Use a boolean to know whether src/sink time need to be recalculated

Avoids 50% calls to gst_segment_to_running_time()
2009-10-07 09:06:21 +02:00
Edward Hervey
b1945ad429 plugins/queue: Just cast to the object parent instead of typechecking. 2009-10-07 09:06:11 +02:00
Tim-Philipp Müller
6ce1f0cbce dataqueue, elements: avoid unnecessary runtime type checks 2009-10-06 20:04:10 +01:00
Wim Taymans
eaf7582b8f queue: whitespace fixes 2009-08-28 17:49:11 +02:00
Mark Nauwelaerts
3352c5d970 queue: post error message when pausing task
If downstream returns error and upstream has already delivered
everything (including EOS) and will no longer be around to find
out that we paused (and why), post error message.  Fixes #589991.
2009-08-06 13:42:25 +02:00
Wim Taymans
49f24e2044 queue: get caps after making writable
Get the caps of the buffer after we made the buffer writable. This did not
cause any problems but it's nicer this way.
2009-08-06 10:52:56 +02:00
Tim-Philipp Müller
8624aaa415 queue: fix compiler warning
The compiler suggests to add some () to indicate if the && or the || takes
priority, so reflow code a bit so we don't have to add yet another layer
of (). Hopefully this was the intended meaning of the code.
2009-06-15 20:11:05 +01:00
Arnout Vandecappelle
34aeb8ba7e don't lock when min-threshold and max-size conflict.
When min-threshold is set on a queue, it is possible that one of
the minima remains unsatisfied while one of the maxima is already
reached. Therefore, always consider the queue non-empty if it is full.

Fixes #585433.
2009-06-15 19:06:12 +02:00
Ali Sabil
cd1f18bd12 Use the correct unref function 2009-02-22 18:53:10 +01:00
Stefan Kost
1ca248bac6 queue: remove unused code
Skip looping thru a dummy implementation.
2009-02-05 13:59:48 +02:00
Jan Schmidt
18e2042e28 plugins/elements/gstqueue.c: Allow through queries when we don't know how as otherwise it's not possible to query the...
Original commit message from CVS:
* plugins/elements/gstqueue.c:
Allow through queries when we don't know how
to adjust them (not TIME or BYTES), as otherwise it's
not possible to query the current position in order
to seek in other formats at all.
2008-10-08 11:20:17 +00:00
Wim Taymans
66d6f67b02 plugins/elements/gstqueue.c: Add and use a custom acceptcaps function instead of falling back to the potentially less...
Original commit message from CVS:
* plugins/elements/gstqueue.c: (gst_queue_init),
(gst_queue_acceptcaps):
Add and use a custom acceptcaps function instead of falling back to the
potentially less optimized default implementation.
2008-07-31 08:37:04 +00:00
Stefan Kost
ef70805d24 plugins/elements/: Remove short_description. Add basic docs for gsttypefindelement.
Original commit message from CVS:
* plugins/elements/gstcapsfilter.c:
* plugins/elements/gstfakesink.c:
* plugins/elements/gstfakesrc.c:
* plugins/elements/gstfdsink.c:
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstfilesink.c:
* plugins/elements/gstfilesrc.c:
* plugins/elements/gstidentity.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gstqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
Remove short_description. Add basic docs for gsttypefindelement.
Simplify markup for fakesrc/fdsrc.
2008-06-20 10:14:54 +00:00
Tim-Philipp Müller
449a426169 plugins/elements/gstqueue.c: Since we're not called only from the chain function any longer, we can't assume that the...
Original commit message from CVS:
* plugins/elements/gstqueue.c: (gst_queue_leak_downstream):
Since we're not called only from the chain function any longer,
we can't assume that there's always data in the queue, so move
the is_full check to the beginning of the loop (otherwise we'd
hit the assert when changing the limit properties while the
queue is empty or not running yet).
Also, only set a discont if items were actually removed from
the queue.
* tests/check/elements/queue.c: (test_leaky_downstream):
Test case for the above.
2008-04-30 14:20:48 +00:00
Jonas Holmberg
0da9f87257 plugins/elements/gstqueue.c: When changing thr max capacity of a leaky queue, immediatly drop buffers instead of wait...
Original commit message from CVS:
Patch by: Jonas Holmberg <jonas dot holmberg at axis dot com>
* plugins/elements/gstqueue.c: (gst_queue_leak_downstream),
(gst_queue_chain), (queue_capacity_change),
(gst_queue_set_property):
When changing thr max capacity of a leaky queue, immediatly drop buffers
instead of waiting for a push on the sinkpad. Fixes #530637.
2008-04-30 09:35:43 +00:00
Olivier Crete
8c484d5a14 plugins/elements/gstqueue.c: Add the min-threshold to the min latency if possible. Fixes #529148.
Original commit message from CVS:
Patch by: Olivier Crete <tester at tester dot ca>
* plugins/elements/gstqueue.c: (gst_queue_handle_src_query):
Add the min-threshold to the min latency if possible. Fixes #529148.
2008-04-21 08:34:09 +00:00
Sebastian Dröge
b0346dff44 Define G_PARAM_STATIC_STRINGS if it's undefined (GLib < 2.13.0) and use it everywhere for GParamSpecs that use static...
Original commit message from CVS:
* docs/pwg/advanced-dparams.xml:
* docs/pwg/building-props.xml:
* docs/pwg/other-source.xml:
* gst/glib-compat.h:
* gst/gstbin.c: (gst_bin_class_init):
* gst/gstclock.c: (gst_clock_class_init):
* gst/gstindex.c: (gst_index_class_init):
* gst/gstobject.c: (gst_object_class_init):
* gst/gstpad.c: (gst_pad_class_init):
* gst/gstpipeline.c: (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init):
* libs/gst/base/gstbasesrc.c: (gst_base_src_class_init):
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_class_init):
* libs/gst/base/gstdataqueue.c: (gst_data_queue_class_init):
* libs/gst/check/gstcheck.c: (_gst_check_fault_handler_restore),
(_gst_check_fault_handler_sighandler),
(_gst_check_fault_handler_setup), (gst_check_init):
* libs/gst/controller/gstcontroller.c:
(_gst_controller_class_init):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_class_init):
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_class_init):
* plugins/indexers/gstfileindex.c: (gst_file_index_class_init):
Define G_PARAM_STATIC_STRINGS if it's undefined (GLib < 2.13.0) and
use it everywhere for GParamSpecs that use static strings (i.e. all).
This gives us less memory usage, fewer allocations and thus less
memory defragmentation. Fixes bug #523806.
2008-03-22 14:56:17 +00:00
Stefan Kost
10a0bd0e5a plugins/elements/gstqueue.c: Ensure that buffer metadata is writeable, before modifying. Spotted by
Original commit message from CVS:
* plugins/elements/gstqueue.c:
Ensure that buffer metadata is writeable, before modifying. Spotted by
Mike.
2008-02-21 10:22:36 +00:00
Stefan Kost
0b9cfcfbcd plugins/elements/gstqueue.*: When dropping buffers in leaky modes, mark next buffers we sent as
Original commit message from CVS:
* plugins/elements/gstqueue.c:
* plugins/elements/gstqueue.h:
When dropping buffers in leaky modes, mark next buffers we sent as
DISCONT.
2008-02-20 15:44:33 +00:00
Sebastian Dröge
2faa733276 Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
Sebastian Dröge
9db28f8537 Don't use base_init where not absolutely necessary. For example it's not necessary anymore for adding pad templates o...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_class_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_type),
(gst_base_sink_class_init):
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_class_init):
* libs/gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_class_init):
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_base_init),
(gst_collect_pads_class_init):
* libs/gst/base/gstdataqueue.c: (gst_data_queue_get_type):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_base_init),
(gst_net_time_provider_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
Don't use base_init where not absolutely necessary. For example it's
not necessary anymore for adding pad templates or setting element
details.
Leave empty base_init functions in several places as GST_BOILERPLATE
still defines and uses them.
2008-02-03 12:04:37 +00:00
Stefan Kost
bb523ea0a3 Due to popular request remove preset interface again. :-(.
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* docs/gst/gstreamer.types.in:
* gst/Makefile.am:
* gst/gst.h:
* gst/gstpreset.c:
* gst/gstpreset.h:
* plugins/elements/gstqueue.c:
Due to popular request remove preset interface again. :-(.
2007-11-26 13:16:00 +00:00
Stefan Kost
3aca801f4d gst/gstpreset.c: Add some comments and TODOs.
Original commit message from CVS:
* gst/gstpreset.c:
Add some comments and TODOs.
* gst/gstpreset.h:
Add padding for future changes.
* plugins/elements/gstqueue.c:
Implement the iface.
2007-11-17 17:24:53 +00:00
Tim-Philipp Müller
b150d54e1c gtk-doc fixes; trailing-comma-in-enum fix.
Original commit message from CVS:
* docs/plugins/gstreamer-plugins-sections.txt:
* gst/gstdebugutils.h:
* gst/gstxml.h:
* plugins/elements/gstqueue.c:
gtk-doc fixes; trailing-comma-in-enum fix.
2007-11-02 17:43:25 +00:00
Wim Taymans
5363f86bb1 plugins/elements/: Fix queue negotiation. If acceptcaps unconditionally returns TRUE, upstream is tricked into thinki...
Original commit message from CVS:
* plugins/elements/gstmultiqueue.c: (gst_single_queue_push_one),
(gst_single_queue_new):
* plugins/elements/gstqueue.c: (gst_queue_init),
(gst_queue_push_one):
Fix queue negotiation. If acceptcaps unconditionally returns TRUE,
upstream is tricked into thinking it can suggest a format downstream
while downstream does not support that format. The real problem is that
core calls acceptcaps when pushing a buffer with new caps, for which we
do a little workaround by setting the caps on the srcpad ourselves
before pushing the buffer (until this is figured out). Fixes #486758.
2007-10-15 11:36:37 +00:00
Edward Hervey
3a63262829 plugins/elements/gstqueue.c: Comment the segment-related code... in the PROPER function.
Original commit message from CVS:
* plugins/elements/gstqueue.c: (gst_queue_locked_enqueue),
(gst_queue_locked_dequeue):
Comment the segment-related code... in the PROPER function.
See #482147 and my commit from yesterday.
2007-10-02 09:21:48 +00:00
Edward Hervey
296befc9c3 plugins/elements/gstqueue.c: Disable code that's breaking the current-time-level reporting.
Original commit message from CVS:
* plugins/elements/gstqueue.c: (gst_queue_locked_dequeue):
Disable code that's breaking the current-time-level reporting.
See #482147
2007-10-01 12:31:28 +00:00
Felipe Contreras
38ffdf3a6d plugins/elements/gstqueue.c: Improve debugging. Fixes #480858.
Original commit message from CVS:
Patch by: Felipe Contreras <felipe dot contreras at gmail dot com>
* plugins/elements/gstqueue.c: (update_time_level), (apply_buffer),
(gst_queue_locked_dequeue), (gst_queue_handle_sink_event),
(gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate_push):
Improve debugging. Fixes #480858.
2007-09-28 10:22:40 +00:00
Felipe Contreras
de02b89391 plugins/elements/gstqueue.c: First patch of code cleanups, use the macros and right arguments in the macros to signal...
Original commit message from CVS:
Patch by: Felipe Contreras <felipe dot contreras at gmail dot com>
* plugins/elements/gstqueue.c: (gst_queue_handle_sink_event):
First patch of code cleanups, use the macros and right arguments in the
macros to signal and lock the queue. See #480858.
2007-09-28 10:15:23 +00:00