Commit graph

140 commits

Author SHA1 Message Date
Luis de Bethencourt
ba8b8e4677 aggregator: use GST_STIME_FORMAT for GstClockTimeDiff
No need to manually handle negative value of deadline, GST_STIME_FORMAT does
exactly this.
2015-11-05 12:36:55 +00:00
Stefan Sauer
c1fa51953c aggregator: don't compare templ instance pointers
One can pass the PadTemplate from the element_class or the one from the factory.
While they have the same content, the addresses are different.
2015-11-03 19:11:28 -08:00
Olivier Crête
41344e0315 aggregator: Set to running in a single place
Only set to running when the thread is actually started.
2015-11-03 14:42:52 -05:00
Olivier Crête
cb29839580 aggregator: Document more locking 2015-11-03 14:37:59 -05:00
Olivier Crête
86c33cbb6e aggregator: Hold object lock while manipulating the segment
Make sure the object lock is held when aggregator->segment is
modified.
2015-11-02 20:10:35 -05:00
Olivier Crête
9deb334251 aggregator: Remove dead code
This code will never be called as max>=min in all cases. If the upstream
latency query returned min>max, the function already returned and all
values that are added to those have max>= min.
2015-11-02 19:05:01 -05:00
Sebastian Dröge
4eef8424b9 aggregator: Add create_new_pad() vfunc to allow subclasses to override the default behaviour
Not all aggregator subclasses will have a single pad template called sink_%u
and might do something special depending on what the application requests.

https://bugzilla.gnome.org/show_bug.cgi?id=757018
2015-10-23 16:31:47 +03:00
Sebastian Dröge
ced0aa800a aggregator: Convert GST_ERROR_OBJECT() for seek events to GST_DEBUG_OBJECT() 2015-10-01 17:40:59 +02:00
Sebastian Dröge
bec6d61e42 aggregator: For the start time selection, only set the segment position
segment.time and segment.start can stay the same, and were always the same
before anyway because of a mistake.

https://bugzilla.gnome.org/show_bug.cgi?id=755623
2015-10-01 17:40:59 +02:00
Sebastian Dröge
fc76c936f4 aggregator: Don't forward QOS events to sinkpads that had no buffer yet
Otherwise they will receive a QOS event that has earliest_time=0 (because we
can't have negative timestamps), and consider their buffer as too late

https://bugzilla.gnome.org/show_bug.cgi?id=754356
2015-09-25 23:56:21 +02:00
Olivier Crête
4731451974 aggregator: Keep at least two buffers in the queue in live mode
When in live mode, the queue needs to hold the currently processed
buffer and one more at least.

https://bugzilla.gnome.org/show_bug.cgi?id=754851
2015-09-18 12:17:49 +02:00
Sebastian Dröge
336ca3207a aggregator: Document that get_next_time() should return running time
https://bugzilla.gnome.org/show_bug.cgi?id=753196
2015-09-14 19:56:33 +02:00
Olivier Crête
2fc98af421 aggregator: Also ignore start-time on seek from gst_element_send_event()
https://bugzilla.gnome.org/show_bug.cgi?id=753806
2015-08-31 11:11:48 +03:00
Olivier Crête
6efc106a67 aggregator: Queue "latency" buffers at each sink pad.
In the case where you have a source giving the GstAggregator smaller
buffers than it uses, when it reaches a timeout, it will consume the
first buffer, then try to read another buffer for the pad. If the
previous element is not fast enough, it may get the next buffer even
though it may be queued just before. To prevent that race, the easiest
solution is to move the queue inside the GstAggregatorPad itself. It
also means that there is no need for strange code cause by increasing
the min latency without increasing the max latency proportionally.

This also means queuing the synchronized events and possibly acting
on them on the src task.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-07-30 14:00:05 -04:00
Olivier Crête
69fa4f9a5b aggregator: Default to "zero" start time selection mode as documented 2015-07-29 20:07:09 -04:00
Olivier Crête
50b7d1d577 aggregator: Ignore the "first" mode if the segment not a time segment 2015-07-29 20:06:11 -04:00
Sebastian Dröge
fab880fddc aggregator: Add property to select how to decide on a start time
Before aggregator based elements always started at running time 0,
now it's possible to select the first input buffer running time or
explicitly set a start-time value.

https://bugzilla.gnome.org/show_bug.cgi?id=749966
2015-07-29 14:35:50 +01:00
Sebastian Dröge
730b5c8aa2 aggregator: Query the peer latency again on the next opportunity after a pad was added or removed
Adding a pad will add a new upstream that might have a bigger minimum latency,
so we might have to wait longer. Or it might be the first live upstream, in
which case we will have to start deadline based aggregation.

Removing a pad will remove a new upstream that might have had the biggest
latency, so we can now stop waiting a bit earlier. Or it might be the last
live upstream, in which case we can stop deadline based aggregation.
2015-07-28 23:23:32 +01:00
Thiago Santos
0a495cbea2 aggregator: add a convenience macro to get the source pad
Easier than casting or acessing the parent everywhere
2015-06-08 12:09:51 -03:00
Olivier Crête
10319757b4 aggregator: Document that the latency is in ns 2015-06-01 18:50:14 -04:00
Jan Schmidt
e3ec07220b aggregator: Push EOS on error return.
Before shutting down the srcpad task due to a
downstream error, push an EOS to give downstream
a chance to shut down somewhat cleanly.
2015-05-28 01:03:15 +10:00
Reynaldo H. Verdejo Pinochet
7fb02dc918 aggregator: document gap handling behavior
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2015-04-03 18:17:35 -03:00
Reynaldo H. Verdejo Pinochet
ca2de787db aggregator: drop stale white space at warning 2015-04-03 18:17:35 -03:00
Reynaldo H. Verdejo Pinochet
931fbf5e12 aggregator: implement gap handling
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2015-04-03 18:17:35 -03:00
Olivier Crête
43d4d3c5ca aggregator: Unify downstream flow return and flushing
Also means that having a non-OK downstream flow return
wakes up the chain functions.

https://bugzilla.gnome.org/show_bug.cgi?id=747220
2015-04-02 15:59:27 -04:00
Olivier Crête
b9a422d8d0 aggregator: Flushing is always in pad lock, no need to atomics
The usage of atomics was always doubtful as it was used to release a
GCond

https://bugzilla.gnome.org/show_bug.cgi?id=747220
2015-04-02 15:59:27 -04:00
Olivier Crête
d1bae20802 aggregator: Reset pending_eos on pad flush
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2015-04-02 15:59:27 -04:00
Olivier Crête
38d8db801a aggregator: Unify code to set a pad flushing
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2015-04-02 15:59:27 -04:00
Olivier Crête
5a6024850c aggregator: Query latency on first incoming buffer.
And keep on querying upstream until we get a reply.

Also, the _get_latency_unlocked() method required being calld
with a private lock, so removed the _unlocked() variant from the API.
And it now returns GST_CLOCK_TIME_NONE when the element is not live as
we think that 0 upstream latency is possible.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-04-01 22:39:26 -04:00
Olivier Crête
0656c2fc67 aggregator: Be more aggressive with invalid replies to our latency query
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-03-16 14:31:50 -04:00
Matthew Waters
ee637bef1e aggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS 2015-03-11 13:52:15 +00:00
Arun Raghavan
2e5d6c3a3e aggregator: Use standard upstream latency querying logic
The same functionality is duplicated in the default latency querying
now.
2015-02-27 01:05:51 +05:30
Olivier Crete
880dcd8039 aggregator: Use src_lock to protect latency related members
One has to use the src_lock anyway to protect the min/max/live so they
can be notified atomically to the src thread to wake it up on changes,
such as property changes. So no point in having a second lock.

Also, the object lock was being held across a call to
GST_ELEMENT_WARNING, guaranteeing a deadlock.
2015-02-19 21:22:53 -05:00
Olivier Crête
083df6412f aggregator: Remove untrue comment 2015-02-19 19:05:42 -05:00
Olivier Crête
97f6b7a8aa aggregator: Don't try to push tags while flush seeking
The downstream segment could have been flushed already, so
need to re-send the segment event before re-sending the tags.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-02-19 19:05:27 -05:00
Sebastian Dröge
2516e8111c aggregator: Use the sinkpads iterator directly to query upstream latencies
While gst_aggregator_iterate_sinkpads() makes sure that every pad is only
visited once, even when the iterator has to resync, this is not all we have
to do for querying the latency. When the iterator resyncs we actually have
to query all pads for the latency again and forget our previous results. It
might have happened that a pad was removed, which influenced the result of
the latency query.
2015-02-19 11:04:28 +02:00
Sebastian Dröge
d3205e1363 aggregator: Move gst_aggregator_get_latency_unlocked() a bit
It was between another function and its helper function before, which was
confusing when reading the code as it had nothing to do with the other
functions.
2015-02-19 10:57:09 +02:00
Sebastian Dröge
44ffb87f8a aggregator: Fail the latency query if one of the upstream queries fails 2015-02-19 01:28:06 +02:00
Olivier Crête
c37e82587c aggregator: Document locking order
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-02-18 17:20:03 -05:00
Olivier Crête
17df37d8cb aggregator: Rename confusinly named SRC_STREAM_LOCK macros to SRC_LOCK
This will match the name of the lock itself. It is also not a stream
lock as it not recursive and not held while pushing.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-02-18 17:20:03 -05:00
Olivier Crête
3a3f2b5343 aggregator: Rename confusingly named stream lock to flush lock
This lock is not what is commonly known as a "stream lock" in GStremer,
it's not recursive and it's taken from the non-serialized FLUSH_START event.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-02-18 17:20:03 -05:00
Olivier Crête
36ef8f0bd4 aggregator: Fix macro indendation
Changes no code

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-02-18 17:20:03 -05:00
Tim-Philipp Müller
282dbcee0b aggregator: drop GAP events until we handle them properly 2015-02-13 23:45:20 +00:00
Tim-Philipp Müller
3c2ee8ece5 aggregator: use new gst_aggregator_pad_drop_buffer() 2015-02-13 16:25:45 +00:00
Tim-Philipp Müller
592c2c8105 aggregator: add gst_aggregator_pad_drop_buffer()
steal_buffer() + unref seems to be a wide-spread idiom
(which perhaps indicates that something is not quite
right with the way aggregator pad works currently).
2015-02-13 16:25:45 +00:00
Tim-Philipp Müller
55abf436a0 aggregator: only post latency message if anything changed
Perhaps we should check for element state as well and
only post it if in PLAYING state.
2015-02-13 16:25:14 +00:00
Sebastian Dröge
037928dcf6 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 14:16:21 +01:00
Sebastian Dröge
69a37365f1 aggregator: Pause srcpad task on flow errors
Otherwise we will call the task function over and over again until
upstream finally handled the flow return and shuts us down.
2015-02-10 10:57:38 +01:00
Sebastian Dröge
a5002ea59d aggregator: Streamline latency calculations
Min latency can never be invalid, latency property can never be invalid
either. So no need to check for all these things in various places.
2015-02-06 11:03:57 +01:00
Sebastian Dröge
65b1db2aa2 aggregator: If upstream has no max latency but the subclass has, take the subclass max latency 2015-02-06 11:03:56 +01:00