Commit graph

123 commits

Author SHA1 Message Date
Sebastian Dröge
9a55945c0b appsrc/appsink: Make setting/replacing callbacks thread-safe
Previously we would simply use them without any locking at all, while
using the object lock for setting them. Nothing prevented new callbacks
to be set in the meantime, potentially calling a callback with already
freed user_data.

To prevent this move the callbacks into a reference counted struct and
use the appsrc/appsink mutex to protect access to it, which is used in
all functions calling the callbacks already anyway.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/729
2020-02-14 14:42:19 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Niels De Graef
0314b482f3 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-08-27 07:31:57 +02:00
Wonchul Lee
7883663e26 appsrc: Fix typo in documentation 2019-06-15 14:33:32 +09:00
Wonchul Lee
a75e47e815 appsrc: Fix docs typo
Fix typo empty-percent to min-percent
2019-03-16 14:57:56 +00:00
Tim-Philipp Müller
7b98593280 app: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 21:33:16 +02:00
Sebastian Dröge
a19497ab67 appsrc/sink: Fix optimization for only signalling waiters if someone is actually waiting
It is possible that both application and the stream are waiting
currently, if for example the following happens:
  1) app is waiting because no buffer in appsink
  2) appsink providing a buffer and waking up app
  3) appsink getting another buffer and waiting because it's full now
  4) app thread getting back control

Previously step 4 would overwrite that the appsink is currently waiting,
so it would never be signalled again.

https://bugzilla.gnome.org/show_bug.cgi?id=795551
2018-05-02 18:11:58 +03:00
Vivia Nikolaidou
06aa4e5b68 appsrc: Documentation fix in gst_app_src_push_sample_internal
Make it clear that it doesn't take ownership of the sample.

https://bugzilla.gnome.org/show_bug.cgi?id=795150
2018-04-11 12:28:26 +03:00
Tim-Philipp Müller
4fe5178957 appsrc: don't signal the GCond if no one is waiting on it
Performance optimisation: Keep track whenever the streaming
thread or the application thread are waiting on the GCond for
more space or new data, and only signal on the GCond if someone
is actually waiting. Avoids unnecessary syscalls and thus
context switches.
2018-02-19 16:04:22 +00:00
Tim-Philipp Müller
5a5a1f0dc6 appsrc: use GstQueueArray instead of GQueue for internal item queue
Performance optimisation.

Avoids alloc/free churn for the queue's list nodes.

Depends on new API in GstQueueArray in core.
2018-02-19 16:04:15 +00:00
Tim-Philipp Müller
b60cc0274c appsrc: add support for pushing buffer lists
And samples that carry buffer lists.

https://bugzilla.gnome.org/show_bug.cgi?id=752363
2017-12-09 11:09:16 +00:00
Philippe Normand
d375a28a37 appsrc: handle duration query only if the property was set
https://bugzilla.gnome.org/show_bug.cgi?id=786200
2017-08-12 16:23:27 +01:00
Tim-Philipp Müller
6105420bfc appsrc: fix doc typos 2017-08-01 17:08:08 +01:00
Sebastian Dröge
8be5030d47 appsrc: Add out annotations to gst_app_src_get_latency() 2017-08-01 18:49:23 +03:00
Sebastian Dröge
b56dcb3e20 app: Generate GLib enums with glib-mkenums 2017-04-09 12:29:55 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Tobias Mueller
57ff3ea72f appsrc: fix compiler warning
Initialize min and max _get_property() to gets rid of these
compiler warnings:

gstappsrc.c:741:7: error: 'max' may be used uninitialized in this function
       g_value_set_int64 (value, max);
       ^
gstappsrc.c:733:7: error: 'min' may be used uninitialized in this function
       g_value_set_int64 (value, min);
       ^
Which happens because gcc doesn't know that GST_IS_APP_SRC will never
fail here.

https://bugzilla.gnome.org/show_bug.cgi?id=752052
2016-12-25 13:15:26 +00:00
Seungha Yang
50f74daa2f appsrc: Remove trailing whitespace
https://bugzilla.gnome.org/show_bug.cgi?id=768510
2016-07-11 09:54:11 +03:00
Sebastian Dröge
1032f5c1b3 appsrc: If do-timestamp=TRUE, capture the time when the buffer was pushed to the source
... instead of the time when it was pushed further downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=763630
2016-07-01 14:32:26 +02:00
Tim-Philipp Müller
75f3c7cb85 app: use generic marshallers 2016-05-15 15:26:13 +01:00
Sebastian Dröge
dc8120f298 appsrc: Add duration property for providing a duration in TIME format
https://bugzilla.gnome.org/show_bug.cgi?id=766229
2016-05-10 16:50:32 +03:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Arun Raghavan
91084f49c0 appsrc: Minor documentation cleanup 2016-01-19 12:56:20 +05:30
Kazunori Kobayashi
d43f1b2a5a appsrc: Clear is_eos flag when receiving the flush-stop event
The EOS event can be propagated to the downstream elements when
is_eos flag remains set even after leaving the flushing state.
This fix allows this element to normally restart the streaming
after receiving the flush event by clearing the is_eos flag.

https://bugzilla.gnome.org/show_bug.cgi?id=759110
2015-12-19 11:35:39 +01:00
Philippe Normand
872f40d7d9 appsrc: duration query support based on the size property
https://bugzilla.gnome.org/show_bug.cgi?id=759126
2015-12-08 12:42:46 +02:00
Sebastian Dröge
8613525301 appsrc: Always take the mutex before flushing the queue
Otherwise the application might push new buffers into the queue while we're
flushing, potentially causing the GQueue data structure to become inconsistent
and causing crashes soon after.

https://bugzilla.gnome.org/show_bug.cgi?id=754597
2015-09-09 12:33:02 +03:00
Vikram Fugro
bbe967a278 appsrc: retain the latest caps in queue when flushing
- Retain the latest caps in the internal queue, when
  flushing.
- Add a unit test case for the same.

https://bugzilla.gnome.org/show_bug.cgi?id=754597
2015-09-09 12:27:40 +03:00
Philippe Normand
9361f7c576 appsrc: remove duplicate get_size vfunc assignment 2015-08-31 12:11:10 +03:00
Tim-Philipp Müller
8304893d06 appsrc: optimise caps changing when previously-set caps have not taken effect yet
Only negotiate/change caps once when setting caps twice and
the first-set caps have not been used yet.

Based on patch by Eunhae Choi.

https://bugzilla.gnome.org/show_bug.cgi?id=747517
2015-05-18 13:37:54 +01:00
Ilya Konstantinov
d668b511d1 appsrc: docs grammar fixes
https://bugzilla.gnome.org/show_bug.cgi?id=747516
2015-04-09 20:39:42 +01:00
Nicola Murino
f23736d52f appsrc: handle a sample not having caps or a buffer more gracefully
https://bugzilla.gnome.org/show_bug.cgi?id=746908
2015-03-28 12:00:38 +00:00
Sebastian Dröge
8547594727 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:49 +02:00
Nicola Murino
617f72b526 appsrc: Add push_sample() convenience function for easy appsink -> appsrc use
https://bugzilla.gnome.org/show_bug.cgi?id=728379
2014-09-12 14:07:49 +03:00
Sebastian Dröge
8fc307fae0 appsrc: Some minor fixes and cleanup 2014-08-06 10:07:42 +02:00
Wang Xin-yu (王昕宇)
251c63c4ab appsrc: Make caps set action queued together with buffer
https://bugzilla.gnome.org/show_bug.cgi?id=729760
2014-08-06 10:04:49 +02:00
Youness Alaoui
6b0063aab5 appsrc: Fix memory leak with callback notify not being called in dispose
https://bugzilla.gnome.org/show_bug.cgi?id=733386
2014-07-19 14:38:36 +02:00
Thiago Santos
bbf226d9d6 appsrc: add send_event handler for flushing
Adds a send_event handling for allowing appsrc to flush its internal
data, allowing users to flush the pipeline without setting it to null.

https://bugzilla.gnome.org/show_bug.cgi?id=724231
2014-06-10 12:59:53 -03:00
Tim-Philipp Müller
bcb8068e27 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:28:57 +01:00
Tom Greenwood
360ac34425 appsrc: Fix deadlock that may occur when multiple threads access appsrc at once
https://bugzilla.gnome.org/show_bug.cgi?id=711550
2013-11-07 18:28:09 +01:00
Sebastian Dröge
e2597e1e42 appsrc: Also provide function API for current-level-bytes and integrate into the docs 2013-07-26 11:03:08 +02:00
Changbok Chea
bdbfa45296 appsrc: Add "current-level-bytes" property
https://bugzilla.gnome.org/show_bug.cgi?id=704774
2013-07-26 11:03:08 +02:00
Nicola Murino
2a1dc7ca56 appsrc: fix deadlock setting pipeline in NULL state with block=true 2013-03-12 11:16:57 +01:00
Wim Taymans
ed6e7776f3 appsrc: negotiate before popping buffer
First negotiate and then try to pop a buffer from the queue. This is just
to improve the debug log.
2013-02-06 10:07:47 +01:00
Wim Taymans
d4ed3ddf6f appsrc: always take mutex before object lock
The locking order is to first take the appsrc mutex and then the
object lock.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=693224
2013-02-06 10:00:27 +01:00
Tim-Philipp Müller
020eb24dcf app: fix g-i annotation for gst_app_src_push_buffer()
It takes ownership of the buffer.
2012-11-21 21:53:13 +00:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Tim-Philipp Müller
224fb90469 theora, app: use gst_element_class_set_static_metadata()
Avoids string copies.
2012-10-17 16:54:14 +01:00
Tim-Philipp Müller
80e45be3d0 appsrc: fix max-latency property getter
Was returning the min-latency value.
2012-09-29 21:42:46 +01:00
Mark Nauwelaerts
f7c247b6a3 replace gst_element_class_set_details_simple with gst_element_class_set_metadata 2012-09-14 17:02:59 +02:00
Tim-Philipp Müller
879e6ab35c appsrc: don't clear/free GCond twice 2012-09-10 01:16:41 +01:00