Commit graph

148 commits

Author SHA1 Message Date
Nicolas Dufresne
ff3b60a969 Revert "aggregator: Start the task when linked"
This reverts commit 302580c381.
2016-05-25 13:38:47 -04:00
Nicolas Dufresne
302580c381 aggregator: Start the task when linked
Until now we would start the task when the pad is activated. Part of the
activiation concist of testing if the pipeline is live or not.
Unfortunatly, this is often too soon, as it's likely that the pad get
activated before it is fully linked in dynamic pipeline.

Instead, start the task when the first serialized event arrive. This is
a safe moment as we know that the upstream chain is complete and just
like the pad activation, the pads are locked, hence cannot change.

https://bugzilla.gnome.org/show_bug.cgi?id=757548
2016-05-25 13:35:00 -04:00
Nicolas Dufresne
38895f2364 aggregator: Check all pads for data when live
When live, we still need to inspect all pads queue in order to determin
if we have received the first buffer or not.

https://bugzilla.gnome.org/show_bug.cgi?id=765431
2016-04-26 06:54:37 -04:00
Nicolas Dufresne
fbd824a2b5 aggregator: Fix locking when using the clock
This fixes a race where we check if there is a clock, then it get
removed and we endup calling gst_clock_new_single_shot_id() with a NULL
pointer instead of a valid clock and also calling gst_object_unref()
with a NULL pointer later.

https://bugzilla.gnome.org/show_bug.cgi?id=757548
2016-04-26 06:54:37 -04:00
Aurélien Zanelli
7a599df9f4 aggregator: remove duplicated test of flow_return in pad_chain_internal
https://bugzilla.gnome.org/show_bug.cgi?id=764549
2016-04-04 10:56:33 +03:00
Nirbheek Chauhan
302a4a7b5c aggregator: Fix strcmp test for sink template 2016-03-28 13:46:00 +03:00
Nirbheek Chauhan
cb53a6284f aggregator: Don't try to be too smart while allocating pad names
Previously, while allocating the pad number for a new pad, aggregator was
maintaining an interesting relationship between the pad count and the pad
number.

If you requested a sink pad called "sink_6", padcount (which is badly named and
actually means number-of-pads-minus-one) would be set to 6. Which means that if
you then requested a sink pad called "sink_0", it would be assigned the name
"sink_6" again, which fails the non-uniqueness test inside gstelement.c.

This can be fixed by instead setting padcount to be 7 in that case, but this
breaks manual management of pad names by the application since it then becomes
impossible to request a pad called "sink_2". Instead, we fix this by always
directly using the requested name as the sink pad name. Uniqueness of the pad
name is tested separately inside gstreamer core. If no name is requested, we use
the next available pad number.

Note that this is important since the sinkpad numbering in aggregator is not
meaningless. Videoaggregator uses it to decide the Z-order of video frames.
2016-03-28 13:46:00 +03:00
Sebastian Dröge
c87a7e2667 base/audio/video: Install headers and pkg-config files
They are still considered unstable API but it would be good to give them some
wider testing already to make sure the API is useful.

https://bugzilla.gnome.org/show_bug.cgi?id=760733
2016-01-22 12:39:48 +02:00
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