Commit graph

3061 commits

Author SHA1 Message Date
Nirbheek Chauhan
c18ef6d8a1 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.
2017-12-02 15:10:26 +00:00
Luis de Bethencourt
c0a0102b41 aggregator: use GST_STIME_FORMAT for GstClockTimeDiff
No need to manually handle negative value of deadline, GST_STIME_FORMAT does
exactly this.
2017-12-02 15:10:26 +00:00
Stefan Sauer
c1e6f94157 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.
2017-12-02 15:10:26 +00:00
Olivier Crête
78aa10b5bb aggregator: Set to running in a single place
Only set to running when the thread is actually started.
2017-12-02 15:10:26 +00:00
Olivier Crête
96583f0d18 aggregator: Document more locking 2017-12-02 15:10:26 +00:00
Olivier Crête
dc346ca245 aggregator: Hold object lock while manipulating the segment
Make sure the object lock is held when aggregator->segment is
modified.
2017-12-02 15:10:26 +00:00
Olivier Crête
b95f3e8455 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
bbd11aea40 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
41b4a78b6b aggregator: Convert GST_ERROR_OBJECT() for seek events to GST_DEBUG_OBJECT() 2017-12-02 15:10:26 +00:00
Sebastian Dröge
3db4239aab 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
92a80e6490 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
2017-12-02 15:10:26 +00:00
Olivier Crête
a7845e80f1 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
265ac95553 aggregator: Document that get_next_time() should return running time
https://bugzilla.gnome.org/show_bug.cgi?id=753196
2017-12-02 15:10:26 +00:00
Olivier Crête
2c19653410 aggregator: Also ignore start-time on seek from gst_element_send_event()
https://bugzilla.gnome.org/show_bug.cgi?id=753806
2017-12-02 15:10:26 +00:00
Olivier Crête
22dc57f84e 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
2017-12-02 15:10:26 +00:00
Olivier Crête
5db97caef7 aggregator: Default to "zero" start time selection mode as documented 2017-12-02 15:10:26 +00:00
Olivier Crête
1b3f1b1a4e aggregator: Ignore the "first" mode if the segment not a time segment 2017-12-02 15:10:26 +00:00
Sebastian Dröge
3030d1b501 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
9ab98e9b22 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.
2017-12-02 15:10:26 +00:00
Thiago Santos
07247f01ca aggregator: add a convenience macro to get the source pad
Easier than casting or acessing the parent everywhere
2017-12-02 15:10:26 +00:00
Olivier Crête
0a35f550b2 aggregator: Document that the latency is in ns 2017-12-02 15:10:26 +00:00
Jan Schmidt
b16697d286 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.
2017-12-02 15:10:26 +00:00
Reynaldo H. Verdejo Pinochet
656b7a0594 aggregator: document gap handling behavior
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2017-12-02 15:10:26 +00:00
Reynaldo H. Verdejo Pinochet
3f56fb7189 aggregator: drop stale white space at warning 2017-12-02 15:10:26 +00:00
Reynaldo H. Verdejo Pinochet
c955254758 aggregator: implement gap handling
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2017-12-02 15:10:26 +00:00
Olivier Crête
e73a173224 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
2017-12-02 15:10:26 +00:00
Olivier Crête
30eb13a16d 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
2017-12-02 15:10:26 +00:00
Olivier Crête
c55b6be463 aggregator: Reset pending_eos on pad flush
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2017-12-02 15:10:26 +00:00
Olivier Crête
d88e064019 aggregator: Unify code to set a pad flushing
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2017-12-02 15:10:26 +00:00
Olivier Crête
5a0e2c4c47 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
2017-12-02 15:10:26 +00:00
Olivier Crête
46e33e84fd aggregator: Be more aggressive with invalid replies to our latency query
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2017-12-02 15:10:26 +00:00
Matthew Waters
87b25fb7a5 aggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS 2017-12-02 15:10:26 +00:00
Arun Raghavan
b7155695f8 aggregator: Use standard upstream latency querying logic
The same functionality is duplicated in the default latency querying
now.
2017-12-02 15:10:26 +00:00
Olivier Crete
5ac166a5d9 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.
2017-12-02 15:10:26 +00:00
Olivier Crête
77698267db aggregator: Remove untrue comment 2017-12-02 15:10:26 +00:00
Olivier Crête
8f8430ee9e 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
83203e9dc4 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
075cfd8d7b 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
2b932dc551 aggregator: Fail the latency query if one of the upstream queries fails 2017-12-02 15:10:26 +00:00
Olivier Crête
a42c4740ec aggregator: Document locking order
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
ad2cd52bae 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
2017-12-02 15:10:26 +00:00
Olivier Crête
3c17c777ee 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
2017-12-02 15:10:26 +00:00
Olivier Crête
aa78cf96f4 aggregator: Fix macro indendation
Changes no code

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
e1aba92514 aggregator: drop GAP events until we handle them properly 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
1fe5f9db71 aggregator: use new gst_aggregator_pad_drop_buffer() 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
950b772a0d 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).
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
4e97321898 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
d97d363b1f 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
1609e1d696 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
9213f24716 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
07d9bf9cab aggregator: If upstream has no max latency but the subclass has, take the subclass max latency 2017-12-02 15:10:26 +00:00
Sebastian Dröge
e57b62be72 aggregator: Fix min>max latency error check
We have to include the upstream latency, our own latency and the subclass
latency in the calculations.

FIXME: This is still not entirely correct
2017-12-02 15:10:26 +00:00
Sebastian Dröge
87a2fbab60 aggregator: Don't add the latency property to the max latency
It has no meaning for the max latency and is only used to increase the min
latency.
2017-12-02 15:10:26 +00:00
Thibault Saunier
24abac9fce aggregator: Cleanup locking around AggregatorPad flush related fields
And document the locking

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Mathieu Duponchelle
14f35e8a78 aggregator: keep chain functions as dumb as possible.
+ A pad chain function has no business checking other pads,
  that's what the aggregate thread is for.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Thibault Saunier
97eab82ddf aggregator: More fixes around locking when accessing protected private fields
In some more places we were accessing GstAggregator->segment
and GstAggregator->seqnum without holding the GST_OBJECT_LOCK

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Thibault Saunier
ae12041f0c aggregator: Make the PAD_LOCK private
Instead of using the GST_OBJECT_LOCK we should have
a dedicated mutex for the pad as it is also associated
with the mutex on the EVENT_MUTEX on which we wait
in the _chain function of the pad.

The GstAggregatorPad.segment is still protected with the
GST_OBJECT_LOCK.

Remove the gst_aggregator_pad_peak_unlocked method as it does not make
sense anymore with a private lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Thibault Saunier
5f176b724b aggregator: Hide GstAggregatorPad buffer and EOS fileds
And add a getter for the EOS.

The user should always use the various getters to access
those fields

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
0588222925 aggregator: Document locking of GstAggregatorPrivate members
Most of them are protected by the object lock, specify
which ones use a different lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
fd326639ea aggregator: Document how the segment is protected
Document that it can only be accessed with the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
be58999bff aggregator: Protect all latency related members with the object lock
The locking was not consistent, now consistently use the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
1d5f3fe084 aggregator: Document locking for gst_aggregator_get_latency_unlocked()
Renamed it to _unlocked() to make it clear.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
142073cc79 aggregator: Protect the srcpad caps negotiation with the stream lock
Instead of adding another lock, use the srcpad stream lock, which is already
taken anyway to push out the new caps if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
9add348012 aggregator: Protect the tags with the object lock
The tags related variables were sometimes protected, sometimes not and
sometimes atomic. Put them all under the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
25faafaf58 aggregator: Consistenly lock the flow_return state
Use the object's lock to protect it.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
90f3cb4af0 aggregator: Consistently lock some members
Some members sometimes used atomic access, sometimes where not locked at
all. Instead consistently use a mutex to protect them, also document
that.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
2b7d4e2404 aggregator: Protect exported pad members with the pad's object lock
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
3217e82791 aggregator: Replace event lock with pad's object lock
Reduce the number of locks simplify code, what is protects
is exposed, but the lock was not.

Also means adding an _unlocked version of gst_aggregator_pad_steal_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
6379433a70 aggregator: Protect data with the same mutex as GCond
Whenever a GCond is used, the safest paradigm is to protect
the variable which change is signalled by the GCond with the same
mutex that the GCond depends on.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
d33e6a191e aggregator: Nitpick spacing/punctuation in debug logging 2017-12-02 15:10:26 +00:00
Olivier Crête
ec5ff5f308 aggregator: Remove pointless atomic
It is only modified from the streaming thread
2017-12-02 15:10:26 +00:00
Olivier Crête
53dd0c650f aggregator: Fix query leak 2017-12-02 15:10:26 +00:00
Sebastian Dröge
4534253145 aggregator: Print jitter from clock waiting in the debug logs 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
f4ad5f0cdf aggregator: don't use iterator when setting flush pending on pads 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
0db6fc999b aggregator: check if pads are ready more efficiently
No need to use an iterator for this which creates a temporary
structure every time and also involves taking and releasing the
object lock many times in the course of iterating. Not to mention
all that GList handling in gst_aggregator_iterate_sinkpads().
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
100d860ad2 aggregator: name vfunc arguments consistently 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
50908e60d0 aggregator: add g-i transfer and scope annotations 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
6af6dcb0f7 aggregator: register names of iterate_sinkpads functions with debug system 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
417445c065 aggregator: reduce debug messages for taking/releasing logs to TRACE level
Don't spam debug log with this stuff.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
c5e3fe807a aggregator: move property member into private structure
Our locking (or lack thereof) while accessing this also
looks generally quite dodgy.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
b813456233 aggregator: remove empty dispose function 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
71ec8e2879 aggregator: give private functions namespace prefix
Especially the GST_DEBUG_FUNCPTR ones.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
3793bb8ad9 aggregator: fix up some docs comments in header 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
7302a42ac1 aggregator: remove now-unused system clock member 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
9f417fb08e aggregator: make GstAggregatorPadForeachFunc take an GstAggregatorPad 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
601554df70 aggregator: bring start/stop vfunc semantics in line with other baseclasses
Sub-class should not have to chain up to GstAggregator's start/stop
vfuncs, same as in GstBaseSrc, GstBaseSink, GstBaseTransform etc.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
a7e2a01098 aggregator: remove pointless GST_DEBUG_FUNCPTR
Not useful for GObject vfuncs.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
760d3c5611 aggregator: remove duplicate pad parent_class variable
G_DEFINE_TYPE already provides one, just need to use it.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
85171e3512 aggregator: add _CAST() variants for cast macros 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
5350d8c653 aggregator: make padding larger
Esp. the class structures, can't have enough
spare space for virtual functions.
2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
ced334d397 aggregator: Log to the pad instead of the element
More correct way of doing the same thing as before
2017-12-02 15:10:26 +00:00
Sebastian Dröge
8da3d1e596 aggregator: Make sure that the minimum latencies are never GST_CLOCK_TIME_NONE 2017-12-02 15:10:26 +00:00
Sebastian Dröge
4846f06b41 aggregator: Wait for the minimum latency, not the maximum
The minimum latency is the latency we have to wait at least
to guarantee that all upstreams have produced data. The maximum
latency has no meaning like that and shouldn't be used for waiting.
2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
d18b6de2e6 aggregator: Clamp the min latency at the max if it's greater 2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
b49805a840 aggregator: Print the sinkpad name while logging latency queries
Very useful while debugging.
2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
bbde713640 aggregator: Take the stream lock when iterating sink pads
When iterating sink pads to collect some data, we should take the stream lock so
we don't get stale data and possibly deadlock because of that. This fixes
a definitive deadlock in _wait_and_check() that manifests with high max
latencies in a live pipeline, and fixes other possible race conditions.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
9bac89113e aggregator: Don't leak flush-start events 2017-12-02 15:10:26 +00:00
Sebastian Dröge
f2814fa5e3 aggregator: Also change the default latency to 0, not just the minimum 2017-12-02 15:10:26 +00:00
Sebastian Dröge
6697f1521a aggregator: Fix docs and default value of the latency property 2017-12-02 15:10:26 +00:00
Sebastian Dröge
4c477549d2 aggregator: Also include the subclass latency in the result of the latency query 2017-12-02 15:10:26 +00:00
Sebastian Dröge
5caf89da37 aggregator: Post a latency message if the value of the latency property changes 2017-12-02 15:10:26 +00:00
Sebastian Dröge
7240852e55 aggregator: Wake up the src thread after handling a latency query
Due to changed latencies or changed live-ness we might have to
adjust if we wait on a deadline at all and how long.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
a20863a7ec aggregator: Don't count the number of times we need to wake up but instead check all conditions for waiting again
This simplifies the code and also makes sure that we don't forget to check all
conditions for waiting.

Also fix a potential deadlock caused by not checking if we're actually still
running before starting to wait.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
b1dcc7efb0 aggregator: Add function to allow subclasses to set their own latency
For audiomixer this is one blocksize, for videoaggregator this should
be the duration of one output frame.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
435a477f63 aggregator: Add a timeout parameter to ::aggregate()
When this is TRUE, we really have to produce output. This happens
in live mixing mode when we have to output something for the current
time, no matter if we have enough input or not.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
bf5652f84a aggregator: Some minor cleanup 2017-12-02 15:10:26 +00:00
Matthew Waters
f4b86a6d8c aggregator: make the src pad task drive the pipeline for live pipelines
This removes the uses of GAsyncQueue and replaces it with explicit
GMutex, GCond and wakeup count which is used for the non-live case.

For live pipelines, the aggregator waits on the clock until either
data arrives on all sink pads or the expected output buffer time
arrives plus the timeout/latency at which time, the subclass
produces a buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=741146
2017-12-02 15:10:26 +00:00
Sebastian Dröge
47d0efacf2 aggregator: Unblock events/queries immediately if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2017-12-02 15:10:26 +00:00
Sebastian Dröge
f3c741e74e aggregator: Drop serialized events/queries if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2017-12-02 15:10:26 +00:00
Sebastian Dröge
0ad159dfb4 aggregator: Block serialized events/queries until the pad has consumed all buffers
Otherwise the caps of the pad might change while the subclass still works with
a buffer of the old caps, assuming the the current pad caps apply to that
buffer. Which then leads to crashes and other nice effects.

https://bugzilla.gnome.org/show_bug.cgi?id=740376
2017-12-02 15:10:26 +00:00
Sebastian Dröge
e3b42c8acb aggregator: Fix typo in debug output 2017-12-02 15:10:26 +00:00
Matthew Waters
4bdbb7a98f aggregator: add _get_latency() for subclass usage
API: gst_aggregator_get_latency

https://bugzilla.gnome.org/show_bug.cgi?id=739996
2017-12-02 15:10:26 +00:00
Vineeth T M
376de6cef3 audiomixer: critical error for blocksize, timeout min/max values
Audiomixer blocksize, cant be 0, hence adjusting the minimum value to 1
timeout value of aggregator is defined with MAX of MAXINT64,
but it cannot cross G_MAXLONG * GST_SECOND - 1
Hence changed the max value of the same

https://bugzilla.gnome.org/show_bug.cgi?id=738845
2017-12-02 15:10:26 +00:00
Matthew Waters
3c8198e99f aggregator: add latency query handling 2017-12-02 15:10:26 +00:00
Matthew Waters
efdcc6c8eb aggregator: add a timeout property determining buffer wait time
Determines the amount of time that a pad will wait for a buffer before
being marked unresponsive.

Network sources may fail to produce buffers for an extended period of time,
currently causing the pipeline to stall possibly indefinitely, waiting for
these buffers to appear.

Subclasses should render unresponsive pads with either silence (audio), the
last (video) frame or what makes the most sense in the given context.
2017-12-02 15:10:26 +00:00
Jan Alexander Steffens (heftig)
e8c34afd5f aggregator: Replace GMainContext with GAsyncQueue (v2)
The previous implementation kept accumulating GSources,
slowing down the iteration and leaking memory.

Instead of trying to fix the main context flushing, replace
it with a GAsyncQueue which is simple to flush and has
less overhead.

https://bugzilla.gnome.org/show_bug.cgi?id=736782
2017-12-02 15:10:26 +00:00
Mathieu Duponchelle
aaff6b50f8 aggregator: Set seqnum only when segments are received. 2017-12-02 15:10:26 +00:00
Thibault Saunier
1efd6b2edd aggregator: Add a streaming lock so to secure flush start action
Without a lock that is taken in FLUSH_START we had a rare race where we
end up aggregating a buffer that was before the whole FLUSH_START/STOP
dance. That could lead to very wrong behaviour in subclasses.
2017-12-02 15:10:25 +00:00
Thibault Saunier
d5a3056ef2 aggregator: Query seeking when a seek failed to see if it was expected
And do not worry if seeking failed on a stream that is not seekable
2017-12-02 15:10:25 +00:00
Mathieu Duponchelle
f6adb43916 aggregator: set future seqnum before propagating the seek event.
So the seqnum is properly set for the following events.
2017-12-02 15:10:25 +00:00
Thibault Saunier
eb1d322962 aggregator: Store segment when seeked in READY for later use 2017-12-02 15:10:25 +00:00
Sebastian Dröge
034e74b216 aggregator: Unref the taglist in GstAggregator::stop() 2017-12-02 15:10:25 +00:00
Thibault Saunier
cc14d18e08 aggregator: Take lock to ensure set_caps is not called concurently
Avoiding to be in an inconsistent state where we do not have
actual negotiate caps set as srccaps and leading to point where we
try to unref ->srccaps when they have already been set to NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=735042
2017-12-02 15:10:25 +00:00
Matthew Waters
1a0b4f88c2 aggregator: fix up doc comment for set_src_caps
It does not occur 'later' anymore

https://bugzilla.gnome.org/show_bug.cgi?id=732662
2017-12-02 15:10:25 +00:00
Matthew Waters
42e2933133 videoaggregator: push the caps event as soon as we receive it
Along with the required mandatory dependent events.

Some elements need to perform an allocation query inside
::negotiated_caps().  Without the caps event being sent prior,
downstream elements will be unable to answer and will return
an error.

https://bugzilla.gnome.org/show_bug.cgi?id=732662
2017-12-02 15:10:25 +00:00
Mathieu Duponchelle
5ef53b8a29 aggregator: Reset flow_return *after* stopping the srcpad task.
Otherwise it might be set in an already running aggregate function.
2017-12-02 15:10:25 +00:00
Thibault Saunier
e3075ed3ef aggregator: Flush sinkpads when stopping
All values are meaningless in that case, so we should make sure that
we clean everything
2017-12-02 15:10:25 +00:00
Thibault Saunier
7e5d9daf8e aggregator: Do not forget to reset the flow return when stoping
Setting it to FLUSHING when the element is not started, and to OK
when it starts.
2017-12-02 15:10:25 +00:00
Thibault Saunier
9a88538eca aggregator: Handle event seqnum 2017-12-02 15:10:25 +00:00
Tim-Philipp Müller
3a49e1c311 aggregator: fix locking
We would unlock a mutex we never locked on SEGMENT
events.
2017-12-02 15:10:25 +00:00
Thibault Saunier
481476c439 aggregator: Avoid destroying sources we do not own
+ Unref the maincontext in a new dispose function
+ Make sure to remove all sources on dispose

https://bugzilla.gnome.org/show_bug.cgi?id=732445
2017-12-02 15:10:25 +00:00
Thiago Santos
259a73a3dc aggregator: always store or unref the buffer on the _chain function
Otherwise it leaks, and it is very common to go to flushing when the
pipeline is stopping, leaking a buffer.
2017-12-02 15:10:25 +00:00
Thiago Santos
109f7c937b aggregator: always unref the buffer on _finish function
Otherwise the user doesn't know if it was unref'd or not
2017-12-02 15:10:25 +00:00
Thiago Santos
5f1b50fce4 aggregator: add dispose/finalize functions
Add functions to be able to cleanup the mutex/cond and pending buffers
on the aggregator and on its pad
2017-12-02 15:10:25 +00:00
Matthew Waters
19c8fcfa28 aggregator: plug a memory leak of the srccaps 2017-12-02 15:10:25 +00:00
Thibault Saunier
eace37b743 libs:base: Properly declare APIs as UNSTABLE 2017-12-02 15:10:25 +00:00
Thibault Saunier
bd03141055 aggregator: Fix requested pad name 2017-12-02 15:10:25 +00:00
Thibault Saunier
ae91ee2c98 aggregator: Add new GstAggregator base class
This base class has been added to a newly created libgstbadbase library

Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>

https://bugzilla.gnome.org/show_bug.cgi?id=731917
2017-12-02 15:10:23 +00:00
Michael Tretter
bbafb78b1e ptpclock: do not require a name to create a clock
The gst_ptp_clock_new() does not actually require a name. However, for
example the rtpjitterbuffer may create a clock without a name, fail, and
fall back to not using the PTP clock.

https://bugzilla.gnome.org/show_bug.cgi?id=791034
2017-12-01 10:02:11 +02:00
Matthew Waters
3afc575062 check: add missing harness function to symbol export list
Fixes in user code:

undefined reference to `gst_harness_add_element_sink_pad'

Also reorder harness function list to be strictly in alphabetical order and
double check the list with:

awk '{ if ($1 !~ /#define/) if ($2 ~ /gst_harness_/) { print $2 }; if ($3 ~ /gst_harness_/) { print $3} }' libs/gst/check/gstharness.h | sort
2017-11-25 00:57:54 +11:00
Tim-Philipp Müller
db3ea93439 libs: fix indentation 2017-11-24 13:40:33 +01:00
Havard Graff
df27ec3e67 gstbasetranform: replace GST_BASE_TRANSFORM with GST_BASE_TRANSFORM_CAST
To avoid a global type-lock on chain etc.
2017-11-24 13:39:39 +01:00
Haakon Sporsheim
77502acabc check: Add test suite time elapsed output 2017-11-24 09:50:52 +01:00
Edward Hervey
40187f9247 typefindhelper: Fix overflow some more
Nothing guaranteed that off+size wouldn't exceed a 2**64 value.

Instead we reverse the operation and use a subtraction.
2017-11-04 11:48:40 +01:00
Edward Hervey
4ccdad084b typefindhelper: Fix signed integer overflow
Make sure the whole calculation is done with 64bit unsigned values

(To be ready for people want to typefind exabyte files).
2017-11-04 10:34:10 +01:00
Sebastian Dröge
4c795924db net: Add new file to the meson.build 2017-11-01 12:27:31 +02:00
Robert Rosengren
5d885b9dc7 netutils: Add util for setting socket DSCP
Util function for setting QoS DSCP added, to remove duplicated code in
netclientclock and nettimeprovider. Fix build error if missing IP_TOS.

https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-11-01 11:00:47 +02:00
Robert Rosengren
4c8058272e netclientclock: Add possibility to set QoS DSCP value
https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-10-19 16:14:17 +02:00
Robert Rosengren
a3e1fca7ee nettimeprovider: Add possibility to set QoS DSCP value
https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-10-19 16:14:17 +02:00
Ashish Kumar
250d3e7284 queuearray: Fix for possible crashes due to null pointer dereferencing
https://bugzilla.gnome.org/show_bug.cgi?id=788838
2017-10-16 14:04:58 +03:00
Stefan Sauer
7eea54d6a1 collectpads: mention the query function in the docs as well 2017-10-15 15:59:11 +02:00
fengalin
6617b01af9 flowcombiner: Fix version for ref and unref functions
The functions were introduced in version 1.12.1, GstFlowCombiner was
introduced in 1.4.

https://bugzilla.gnome.org/show_bug.cgi?id=788778
2017-10-10 18:39:26 +03:00
Tim-Philipp Müller
2841b8f0b2 basesink: use new gst_buffer_list_calculate_size() utility function 2017-10-05 13:35:14 +01:00
Havard Graff
fee176d253 meson: remove vs_module_defs
The GST_EXPORT should handle it.
2017-10-05 09:35:41 +01:00
Reynaldo H. Verdejo Pinochet
402159fb88 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 13:54:25 -07:00
Mathieu Duponchelle
a5e168071c plugin dependencies: fix 6cddce7663
There were a few errors:

* The plugin scanner now accepts executable path as an argument.
  In case it is NULL, argc == 2

* We find the executable path in init_pre instead of gst_init,
  allowing this to work when gst is initialized through the
  option group (eg gst-inspect)

* There was a semi-colon missing in the __APPLE__ #ifdef
2017-09-26 15:15:27 +02:00
Mathieu Duponchelle
6cddce7663 plugin: API: GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE
When a plugin declares a dependency using this flag, all the
relative paths are considered to be relative to the path of
the main executable.

We try to determine the path of the executable portably,
with implementations provided for Linux, Windows and Mac.

If retrieval of the path fails, we will not detect changes.

In order for the main executable path to be the same when
scanning a plugin in a child process, a new variable is
exposed in gst_private.h, _gst_executable_path

https://bugzilla.gnome.org/show_bug.cgi?id=788152
2017-09-26 13:12:00 +02:00
Tim-Philipp Müller
39e21bb6dd baseparse: fix taglist update spam
We would constantly re-post the taglist because
posted_avg_rate only gets set to avg_bitrate if
parse->priv->post_avg_bitrate is true, so if it's
false the posted rate will always differ from the
current average rate and we'd queue an update,
which leads to us spamming downstream and the
application with taglist updates.

Fix this by only queuing an update if the average
rate will actually be posted.

These taglists updates could cause expensive
operations on the application side, e.g. in Totem.

https://bugzilla.gnome.org/show_bug.cgi?id=786561
2017-08-25 17:36:33 +01:00
Tim-Philipp Müller
208d500c67 libcheck: fix build failure
Need to define CK_DLL_EXP to extern as well in libcompat.h
which gets included before the internal-check.h where the
other fallback definition for CK_DLL_EXP is.

duplicate symbol _check_minor_version in:
libcheckinternal.a(libcheckinternal_la-check.o)
libcheckinternal.a(libcheckinternal_la-check_log.o)
2017-08-13 10:50:05 +01:00
Tim-Philipp Müller
be8eb436b2 meson: hide symbols by default unless explicitly exported 2017-08-10 13:34:25 +01:00
Tim-Philipp Müller
f5f21e5e8b libs: check: sprinkle some GST_EXPORT
Have to modify libcheck header a bit to avoid warnings
about duplicate 'extern extern'.

Also needs some additions to the libcheck meson.build file
to define CK_EXP_DLL when building the static libcheck.
2017-08-10 12:04:53 +01:00
Luis de Bethencourt
1f89d6d739 check: duplicate code branches
CID #1226446
2017-07-26 15:05:07 +02:00
Tim-Philipp Müller
b37429c995 basesrc: deprecate non-functional "typefind" property
https://bugzilla.gnome.org/show_bug.cgi?id=736565
2017-07-14 17:00:48 +01:00
Jason Lin
5bd4603ed3 basesink: fix buffer leaks if preroll failed
buffer is not unreferened if preroll failed

:Detailed Notes:
- Problem : video freeze when switching from pause to 1/2-FF repeatedly
- RootCause : buffer leaks in basesink
- Solution : unref the buffer if prerolled failed

:Testing Preformed:
How to Test :
pause -> 1/2 FF -> resume -> pause -> 1/2 FF ...

https://bugzilla.gnome.org/show_bug.cgi?id=784932
2017-07-14 14:02:52 +10:00
George Kiagiadakis
bd5b1d00e6 basesrc: forward SINK_MESSAGE events downstream
https://bugzilla.gnome.org/show_bug.cgi?id=784551
2017-07-12 15:23:42 +03:00
Stefan Sauer
2ace5f4191 basesink: use GST_CLOCK_TIME macros for readability
Replace some -1 comparison with GST_CLOCK_TIME macros.
2017-07-09 21:20:03 +02:00
Stefan Sauer
7a4df51b08 collectpads: correct some comments and add more logging
Add more logging to analyze event handling (especially failure cases).
2017-07-09 21:17:43 +02:00
Stefan Sauer
c6bd520b8b docs: add a missing const in bytereader docs
This syncs the prototype with gstbytereader.h
2017-06-29 21:08:01 +02:00
Nicolas Dufresne
dd5905c31a basesrc: Removed unused private member qos_enabled 2017-06-29 10:51:33 -04:00
Nicolas Dufresne
2be51ba60c basesrc: Don't reallocate buffers when flushing
Instead of using gst_buffer_pool_set_active() when flushing, use
gst_buffer_pool_set_flushing(), this avoids uneeded reallocation of the
buffers.
2017-06-29 10:51:33 -04:00
Nicolas Dufresne
523de1a9dc basesrc: Don't hold LIVE_LOCK in create/alloc/fill
Holding this lock on live source prevents the source from changing
the caps in ::create() without risking a deadlock. This has consequences
as the LIVE_LOCK was replacing the STREAM_LOCK in many situation. As a
side effect:

- We no longer need to unlock when doing play/pause as the LIVE_LOCK
  isn't held. We then let the create() call finish, but will block if
  the state have changed meanwhile. This has the benefit that
  wait_preroll() calls in subclass is no longer needed.
- We no longer need to change the state to unlock, simplifying the
  set_flushing() interface
- We need different handling for EOS depending if we are in push or pull
  mode.

This patch also document the locking of each private class member and
the locking order.

https://bugzilla.gnome.org/show_bug.cgi?id=783301
2017-06-29 10:51:33 -04:00
Nicolas Dufresne
946622ec3f basesrc: Protect access to pool and allocator
This was only partly protected by the object lock. Always take the
object lock to access the currently configured pool and allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=783301
2017-06-29 10:51:33 -04:00
Nicolas Dufresne
632952be87 baseparse: sinkcaps can be NULL in default caps negotiation
This was causing harmless assertion about the unreffed caps not being of
type caps.

https://bugzilla.gnome.org/show_bug.cgi?id=784041
2017-06-22 16:00:45 -04:00
Sebastian Dröge
848dee060b controller: Export boxed type copy/free functions for GstControlPoint 2017-06-20 10:00:16 +03:00
Sebastian Dröge
35b426ff19 base: Export boxed type copy/free functions for the remaining types 2017-06-20 09:57:01 +03:00
Andrejs Vasiljevs
d99c9d9944 ptp: Unref timeout GSource for delay requests
https://bugzilla.gnome.org/show_bug.cgi?id=783864
2017-06-16 17:57:35 +03:00
Olivier Crête
67a496c0c2 basesrc: Hold object lock while updating latency
Otherwise in gst_base_src_query_latency(), it ended up
sometimes thinking it wasn't -1 when it was actually.
2017-05-23 00:51:49 +02:00
Tim-Philipp Müller
ce439995c0 meson: check: generate .gir file
https://bugzilla.gnome.org/show_bug.cgi?id=782173
2017-05-20 17:58:21 +01:00
Tim-Philipp Müller
a14a468fd0 Dist meson ptp helper install script
Fixes meson build from tarball.
2017-05-20 16:44:50 +01:00
Sebastian Dröge
f119e93b47 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
I.e. most of them unfortunately.

https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:37 +03:00
Sebastian Dröge
daa98fc02a gst: Don't ref_sink() GstObject subclasses in instance_init/constructor
This is something bindings can't handle and it causes leaks. Instead
move the ref_sink() to the explicit, new() constructors.

This means that abstract classes, and anything that can have subclasses,
will have to do ref_sink() in their new() function now. Specifically
this affects GstClock and GstControlSource.

https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:37 +03:00
Sebastian Dröge
30f871d274 gst: Correctly annotate functions taking floating reference parameters and returning floating references
https://bugzilla.gnome.org/show_bug.cgi?id=702960
2017-05-17 10:40:37 +03:00
Tim-Philipp Müller
c811e86d6b libs: controller: mark symbols explicitly for export with GST_EXPORT 2017-05-15 23:14:04 +01:00
Tim-Philipp Müller
d8f23c9786 libs: base: mark symbols explicitly for export with GST_EXPORT 2017-05-15 23:13:53 +01:00
Tim-Philipp Müller
72103b7d51 libs: net: mark symbols explicitly for export with GST_EXPORT 2017-05-15 23:13:39 +01:00
Stefan Sauer
51f74e4825 docs: remove stray ',\' from doc comment 2017-05-12 17:49:25 +02:00
Tim-Philipp Müller
04a0eace30 meson: fix search path for setcap 2017-05-09 09:24:43 +01:00
Tim-Philipp Müller
c8f8395f41 meson: fail silently in ptp helper post install script
.. in case permissions/capabilities could not be set.
2017-05-05 12:23:43 +01:00
Tim-Philipp Müller
0d33e8f11d meson: use cc.find_library()
find_library() was deprecated and removed in later versions.
2017-05-05 12:02:33 +01:00
Tim-Philipp Müller
dcfb222e05 meson: add gst-ptp-helper
https://bugzilla.gnome.org/show_bug.cgi?id=774418
2017-05-05 11:49:08 +01:00
Tim-Philipp Müller
cccd76aa99 helpers: remove old cruft from CLEANFILES
These files are no longer built, so no need to clean them.
2017-05-05 00:45:27 +01:00
Tim-Philipp Müller
3d8d81ecb7 g-i: no need to load registry in g-i scanner 2017-05-04 21:59:48 +01:00
Yasushi SHOJI
5d40e49d12 harness: Abort when failed to construct the specified pipeline
gst_harness_new_parse() returns without any error even if it doesn't
find the specified element.  Then a succeeding call to
gst_harness_set_sink_caps_str() causes an error like this:

	Unexpected critical/warning: gst_pad_push_event: assertion 'GST_IS_PAD (pad)' failed

This is a bit cryptic and doesn't give users any clue what was going
on.

gst_harness_new_parse() calls gst_harness_add_parse() with a newly
created empty harness and the given pipeline description string, but
gst_harness_add_parse() does not have a way to propagate the error
back to the caller.  Since the function, gst_harness_add_parse(), is a
public API, it's not a good idea to change its signature.  This patch,
instead, makes the function to g_error() when it discovers any error.
With this change the same error prints:

	** (myelement-test:25345): ERROR **: Unable to create pipeline 'bin.( myelement )': no element "myelement"

The current implementation of gst_parse_launch_full() doesn't return
partially constructed pipeline when GST_PARSE_FLAG_FATAL_ERRORS is
specified, however, this patch also adds a check for it.

https://bugzilla.gnome.org/show_bug.cgi?id=781958
2017-05-04 19:48:33 +01:00
Sebastian Dröge
733de3190b adapter: Check if meta transform_func is NULL before using it
https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:27:14 +03:00
Frédéric Dalleau
ca7fa6a661 basetransform: Check if meta transform_func is NULL before using it
An untested pointer segfaulted in webkit while playing video
on imx6 sabrelite. It turned out that the imx plugin didn't
implement the meta transform function.

The following GST_DEBUG trace was visible:
gstbasetransform.c:1779:foreach_metadata:<conv2> copy metadata
                                                GstImxVpuBufferMetaAPI

Thread 26 vqueue:src received signal SIGSEGV, Segmentation fault.

(gdb) bt
 0x00000000 in ?? ()
 0x73f8d7d8 in foreach_metadata (inbuf=0xc9b020, meta=0x474b2490,
                  user_data=<optimized out>) at gstbasetransform.c:1781
 0x73eb3ea8 in gst_buffer_foreach_meta (buffer=buffer@entry=0xc9b020,
                  func=0x73f8d705 <foreach_metadata>,
                  user_data=user_data@entry=0x474b24d4)
                  at gstbuffer.c:2234

https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:26:21 +03:00
Yasushi SHOJI
c423df49af basetransform: fix typo in debug log output
This unbalanced closing parenthesis is leftover from the commit
8b739d91e7. It used to wrap the caps but we don't seem to do that in
the current code.

So, just remove it. No functionality has been changed.

https://bugzilla.gnome.org/show_bug.cgi?id=781484
2017-04-19 09:21:32 +01:00
Rico Tzschichholz
72e42f0ce9 meson: A couple for GIR-generation fixes 2017-04-13 10:05:53 +01:00
Thibault Saunier
15566bf505 meson: Add controller enum file as generated sources
Avoiding build failure like
https://ci.appveyor.com/project/thiblahute/gst-build-ge9m5/build/1.0.2857
2017-04-12 10:03:29 -03:00
Tim-Philipp Müller
89ce63ee6c controller: include new proxycontrolbinding header
And fix includes in docs to just include the main header (the
include for the proxycontrolbinding was wrong in the docs).
2017-04-11 20:18:29 +01:00
Sebastian Dröge
9a04087347 controller: Fix build with srcdir!=builddir 2017-04-10 14:26:42 +03:00
Rico Tzschichholz
f34c8aac4d controller: Add missing sources/headers to the GIR build 2017-04-10 13:52:41 +03:00
Sebastian Dröge
1365e675c6 meson: And actually make the controller mkenums rules work 2017-04-09 12:16:39 +03:00
Sebastian Dröge
c7cc48b42e controller: Generate GLib enums automatically 2017-04-09 12:06:55 +03:00
Tim-Philipp Müller
519d64881f Don't use deprecated g_object_newv()
Use g_object_new() instead which nowadays has a shortcut for the
no-properties check. It still does an extra GType check in the
function guard, but there's a pending patch to remove that
and it's hardly going to be a performance issue in practice,
even less so on a system that's compiled without run-time checks.

Alternative would be to move to the new g_object_new_properties()
with a fallback define for older glib versions, but it makes the
code look more unwieldy and doesn't seem worth it.

Fixes deprecation warnings when building against newer GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=780903
2017-04-08 09:49:59 +01:00
Nicolas Dufresne
35c4428083 meson: Add bash completion support 2017-04-04 14:46:48 -04:00
Nicolas Dufresne
bae1fe254a completion: Place the completion helper in libexec
This patch reorganize the bash completion scripts in order to install
the binary helper (gst-completion-helper) in libexec path rather then
share folder. Most Linux hierarchy compliance requires that no binary
executable are placed in share. We also cleanup the unused .pc entries
and remove copy pasted parts of the script. Note that other project
including the common helper, should now use $_GST_HELPER to read
the binary executable gst-completion-helper. This helper is not longer
version, as it is placed in a versionned subfolder
(libexec/gstreamer.10) just like the other helpers (scanner and ptp).
2017-04-04 14:46:48 -04:00
Sebastian Dröge
50ec7129bb queuearray: Add G_BEGIN_DECLS and G_END_DECLS to make it usable from C++ code 2017-03-24 14:21:55 +02:00
Jan Schmidt
e571002dcb baseparse: Don't forget error returns when processing more
If parsing returns a non-OK flow return in the middle
of processing an input buffer, don't overwrite that
if a later return is OK again - the subclass might
return not-linked in the middle, and then discard
subsequent data without pushing while returning OK.

A later success doesn't invalidate the earlier failure,
but we should continue processing after not-linked, so
as to keep parse state consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=779831
2017-03-22 11:42:53 +11:00
Wim Taymans
586b34436e buffer: handle gst_buffer_map failures 2017-03-10 10:13:05 +01:00
Tim-Philipp Müller
834fd18dfa bytereader: fix peek value when scanning for 00 00 01 with non-0 offset
We would add the offset a second time in _scan_for_start_code()
when we found a result, but it's already been added to the data
pointer at the beginning of _masked_scan_uint32_peek(), so the
peeked value would be wrong if the initial offset was >0, and
we would potentially read memory out-of-bounds.

Add unit test for all of this.

https://bugzilla.gnome.org/show_bug.cgi?id=778365
2017-02-22 11:07:24 +00:00
Stefan Sauer
c189827619 gstbasesink: xref symbol in docs 2017-02-15 21:37:31 +01:00
Thibault Saunier
5ef7a20687 meson: libs: Add gir to the source list of the dependency 2017-01-27 16:36:39 -03:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Julien Isorce
b2c05cac8e baseparse: correctly handle non-flush seek
Otherwise when seeking/looping to the start when reaching the end,
the sink waits for the duration of the stream. So the user hears
nothing for the duration of the stream before it actually loop again.
See example attached to the bug for that.

Existing test:
gst-plugins-good/tests/icles/test-segment-seeks foo.flac
Without the patch the user hears a crack/cut at each seek.

https://bugzilla.gnome.org/show_bug.cgi?id=777780
2017-01-26 16:51:21 +00:00
Stian Selnes
0c36e5766d check: Add API to filter g_warning/g_critical etc
New API functions to filter log messages before they are processed by
GstCheck. This can be used to discard specific messages that are
accepted by the test or to add callbacks that test specific messages.

Default bevavior when no callback is given to a filter is to discard the
message, because it does not makes sense to have a filter with no
callback which does not discard; that would be a noop.

Discarded messages will in addition to bypass the GstCheck handling also
return to GLib that the message is not fatal if it occurs.

https://bugzilla.gnome.org/show_bug.cgi?id=773091
2017-01-24 00:11:59 +00:00
Mark Nauwelaerts
9bcebaacc7 baseparse: also unset DISCONT on buffers in reverse playback fragments 2016-12-28 13:46:33 +01:00
Fabrice Bellet
de65529d52 basesink: fix a use after free case
The event may be disposed while being pushed, so we make sure the
debug infrastructure won't use it after the gst_pad_push().
2016-12-17 09:40:25 +05:30
Tim-Philipp Müller
bb28a59d5b check: fix typo in docs 2016-12-16 18:30:46 +00:00
Tim-Philipp Müller
6354b57295 check: export new global variable 2016-12-16 18:20:45 +00:00
Thibault Saunier
7b3d383971 check: Avoid possible double free 2016-12-16 14:00:18 -03:00
Thibault Saunier
f7255f318f check: Allow listing unit tests names
Adding options while running gst_check_init

https://bugzilla.gnome.org/show_bug.cgi?id=775540
2016-12-16 13:46:39 -03:00
Nirbheek Chauhan
f8df150e29 check: Fix macro check for OS X
TARGET_OS_MAC is defined on all Apple platforms. You need to check for
!TARGET_OS_IPHONE to detect OS X (now called macOS).
2016-12-09 22:39:36 +05:30
Nirbheek Chauhan
77af10a521 check: Don't try to include CoreServices.h on iOS
On iOS, we have MobileCoreServices.h but it's not really needed.
2016-12-09 18:01:35 +05:30
Nirbheek Chauhan
e60bd6c662 check: Don't check for malloc/realloc and try to fallback
When malloc is not available, this will set #define malloc rpl_malloc
which is implemented only inside libcheck, and not everything will link
to libcheck.

We don't really need to care too much about how malloc is implemented
and we don't care about platforms that don't implement malloc.
2016-12-09 17:59:53 +05:30
Nirbheek Chauhan
958d791d3c Add a README.txt with context for libcheck
https://bugzilla.gnome.org/show_bug.cgi?id=775870
2016-12-09 16:03:41 +05:30
Nirbheek Chauhan
d8e8e92176 libcheck: Update the compatibility code and checks
This brings us up-to-speed with the latest compatibility code from upstream
check git. For completeness, we do all the checks that upstream check does, but
we skip the snprintf/vsnprintf code because it's not straightforward (involves
running code and that is bad for cross-compilation) and not necessary for the
platforms we support anyway.

If someone really wants this, they can uncomment this and copy the relevant
checks from the check git repository.

https://bugzilla.gnome.org/show_bug.cgi?id=775870
2016-12-09 15:31:01 +05:30
Nirbheek Chauhan
eb1f861012 libcheck: Just move libcompat files to a subdir
Makes it clearer which files are actually used in libcheck and which are used
for cross-platform compatibility. This is going to be especially useful when we
add all the libcompat fallback code that upstream libcheck has which will add
about 6 new files.

https://bugzilla.gnome.org/show_bug.cgi?id=775870
2016-12-09 15:31:01 +05:30
Nirbheek Chauhan
0bb6d590cc libcheck: port to latest check git
Upstream seems to have stopped doing releases, but we need to update for better
Windows and Visual Studio support.

This patch only updates the libcheck sources and ignores the compatibility
sources for now.

https://bugzilla.gnome.org/show_bug.cgi?id=775870
2016-12-09 15:31:01 +05:30
Ricardo Ribalda Delgado
0728b9b59b helpers/gst: Get bash completion options from gst-launch
It is more likely that gst-launch is installed than ges-launch

Reported-by: Marianna Smidth Buschle <msb@qtec.com>

https://bugzilla.gnome.org/show_bug.cgi?id=775714
2016-12-06 18:25:23 +00:00
Marcin Kolny
90f101981c net: set clock name in the constructor
gst_net_client_clock_new() and gst_ntp_clock_new() didn't set the
"name" property.

https://bugzilla.gnome.org/show_bug.cgi?id=775538
2016-12-06 12:10:17 +02:00
Olivier Crête
e6febb5bc1 basesink: Document the interaction between unlock() and wait_preroll()
This was totally non-obvious, the kind of big problem is that subclasses must
be able to unblock their streaming thread and continue exactly where they left off
on unpause!

https://bugzilla.gnome.org/show_bug.cgi?id=773912
2016-11-23 11:58:43 -05:00
Matthew Waters
3eb4896435 controllers: add new proxy control binding
Allows proxying the control interface from one property on one GstObject
to another property (of the same type) in another GstObject.

E.g. in a parent-child relationship, one may need to
gst_object_sync_values() on the child and have a binding (set elsewhere)
on the parent update the value.

Note: that this doesn't solve GObject property forwarding and must be
taken care of by the implementation manually or using GBinding.

https://bugzilla.gnome.org/show_bug.cgi?id=774657
2016-11-23 17:15:09 +11:00
Sebastian Dröge
f08c8d2da3 basetransform: Ensure to set the RECONFIGURE flag again if reconfiguration failed
It might've failed just because of flushing or other things, and we
should retry again on the next possibility if something ever calls in
here again.

https://bugzilla.gnome.org/show_bug.cgi?id=774623
2016-11-18 12:04:18 +02:00
Jan Schmidt
2e579a7c1b baseparse: Fix previous commit
Check the correct segment format value.

parse->segment.format is the format we're outputting in,
not the upstream format. Use parse->priv->upstream_format instead,
and make sure it's set in pull mode.
2016-11-16 00:30:26 +11:00
Jan Schmidt
d81c0aec81 baseparse: Restrict query/convert responses when demuxing
If the parser is not parsing a raw elementary stream, restrict
the position, duration and conversion query replies to
things we can sensibly answer about - especially don't do
random conversions to/from bytes.
2016-11-16 00:12:22 +11:00
Scott D Phillips
075744a894 Cast away const from GstMetaInfo in *_get_meta_info() functions
MSVC warns about the const in the implicit argument conversion in the
calls to g_once_init_{enter,leave}. It's OK so explicitly cast it.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-15 14:51:18 +02:00
Scott D Phillips
1e30725331 typefindhelper: Update prototype of helper_find_suggest()
forward declaration prototype is updated to match the change in:

 5a72c23 Change some types to match their prototypes

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-15 14:29:36 +02:00
Thibault Saunier
ae608845ca meson: require meson 0.36 and use new pic arg on static libs
Removes a meson warning and some special casing we had.
2016-11-14 19:21:13 +00:00
Scott D Phillips
5a72c23a54 Change some types to match their prototypes
Particularly note that the underlying integer type of the enum
GstTypeFindProbability is implementation dependent and may not match
guint.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-14 21:03:57 +02:00
Nicolas Huet
9cd2677791 adapter: fix distance when getting prev pts/dts at offset
https://bugzilla.gnome.org/show_bug.cgi?id=765662
2016-11-11 18:18:23 +00:00
Guillaume Desmottes
fcb938caae basetransform: fix pool leak when early returning in decide_allocation
https://bugzilla.gnome.org/show_bug.cgi?id=769023
2016-11-11 13:29:35 +00:00
Seungha Yang
562681a1b7 basesrc: Support PROTECTION event from application
Application may want to send PROTECTION event to the src element.

https://bugzilla.gnome.org/show_bug.cgi?id=769775
2016-11-11 13:07:51 +00:00
Nirbheek Chauhan
0e439fe6ad meson: Fir dependencies of gstnet-1.0
It depends on gst_base_dep which will pull in gst_dep
2016-11-11 04:42:30 +05:30
Nirbheek Chauhan
accd0b4129 meson: Add GstBase-1.0.gir to gst_base_dep
Without this, GIR generators can't find and use it
2016-11-11 04:41:39 +05:30
Tim-Philipp Müller
bce5d0fc55 baseparse: add since marker for new API to docs and fix win32 .def file 2016-11-10 13:49:29 +00:00
Vincent Penquerc'h
4caf66fbca baseparse: expose gst_base_parse_drain 2016-11-10 12:47:37 +00:00
Thibault Saunier
0079aea21c meson: Advertise dependency on gst_dep generating girs
And do not simply link to libgst as the gir information
location only exist in declare_dependecy

https://bugzilla.gnome.org/show_bug.cgi?id=774044
2016-11-09 17:00:49 -03:00
Nicolas Dufresne
7c8087f49a basesink: Make sure we never drop the preroll buffer
This is cosmetic as 'late' should never be set during preroll (in pause).
Though code may evolve in the future, so this is good for preventing
potential bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=772468
2016-11-03 15:26:06 -04:00
Nicolas Dufresne
5ca63b7f04 basesink: Don't nest prepare/render calls
When the first buffer arrives, we endup calling:

  ->prepare()
    ->prepare()
    ->preroll()
  ->render()

This will likely confuse any element using this method. With this patch,
we ensure the preroll take place before the first render prepare() is
called. This will result in:

  ->prepare()
  ->preroll()
  ->prepare()
  ->render()

https://bugzilla.gnome.org/show_bug.cgi?id=772468
2016-11-03 13:19:46 -04:00
Luis de Bethencourt
c53b2e3740 basesink: fix typo in documentation
Small typo in the documentatin of gst_base_sink_set_drop_out_of_segment().
Fixing it.
2016-11-02 16:28:08 +00:00