Commit graph

2138 commits

Author SHA1 Message Date
Tim-Philipp Müller
7e2ace8618 base: GST_EXPORT -> GST_BASE_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 00:46:00 +00:00
Nicolas Dufresne
cbd03e26ce basesrc: Balance unlock/unlock_stop in _src_stop()
Otherwise it's possible that we won't be able to start again
depending the implementation. We do start/stop in normal use cases
whenever GST_QUERY_SCHEDULING happens before we are started.

https://bugzilla.gnome.org/show_bug.cgi?id=794149
2018-03-07 20:03:56 -05:00
Nicolas Dufresne
12c5d903c9 basesrc: No need to stop flushing in start_complete
The flushing state is handled a bit differently, there is no need
to stop flushing in start_complete. This would other result in
unlock_stop being called without unlock_start.

Unlike what the old comment says, there is no need to take the live
lock here, we are still single threaded at this point (app thread
or the state change thread). Also, we will wait for playing state
in create/getrange, no need to do that twice.

https://bugzilla.gnome.org/show_bug.cgi?id=794149
2018-03-07 20:03:56 -05:00
Sebastian Dröge
89eac59e92 queuearray: Implement pop_tail_struct() for completeness
All other variants of {peek,pop}_{head,tail}_{,struct} were already
implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=794035
2018-03-05 09:39:57 +02:00
Olivier Crête
23b32d5600 queue: Ignore thresholds if a query is queued
The queue gets filled by the tail, so a query will always be the tail
object, not the head object. Also add a _peek_tail_struct() method to the
GstQueueArray to enable looking at the tail.

With unit test to prevent future regression.

https://bugzilla.gnome.org/show_bug.cgi?id=762875
2018-03-01 16:31:57 -05:00
Mathieu Duponchelle
8c10f1e2b4 gstaggregator: pads must inherit from #GstAggregatorPad
Document this, and take advantage of that fact to use
GstAggregator.srcpad.segment instead of GstAggregator.segment

https://bugzilla.gnome.org/show_bug.cgi?id=793942
2018-03-01 15:25:53 +01:00
Mathieu Duponchelle
a567cc13a5 Revert "gstaggregator: pads must inherit from #GstAggregatorPad"
This reverts commit 9774b3775d.

Pushed by mistake
2018-03-01 01:15:34 +01:00
Mathieu Duponchelle
9774b3775d gstaggregator: pads must inherit from #GstAggregatorPad
Document this, and take advantage of that fact to use
GstAggregator.srcpad.segment instead of GstAggregator.segment

https://bugzilla.gnome.org/show_bug.cgi?id=793942
2018-03-01 00:39:50 +01:00
Mathieu Duponchelle
f1aba33090 aggregator: allow src GstAggregatorPads
See https://bugzilla.gnome.org/show_bug.cgi?id=793917

https://bugzilla.gnome.org/show_bug.cgi?id=793934
2018-03-01 00:39:08 +01:00
Nicolas Dufresne
91798e16cc baseparse: Fix integer overflow in bitrate calculation
https://bugzilla.gnome.org/show_bug.cgi?id=793284
2018-02-22 16:14:57 -05:00
Nicolas Dufresne
a84b886a7d baseparse: Avoid overflow in update_interval calculation
https://bugzilla.gnome.org/show_bug.cgi?id=793284
2018-02-22 16:14:57 -05:00
Nicolas Dufresne
25aed8c7ff baseparse: Fix check for update_interval
update_interval may be -1

https://bugzilla.gnome.org/show_bug.cgi?id=793284
2018-02-22 16:14:57 -05:00
Tim-Philipp Müller
bbf8f50cde queuearray: add _peek_tail() and _pop_tail()
API: gst_queue_array_pop_tail()
API: gst_queue_array_peek_tail()

These will be needed later for appsrc.
2018-02-19 15:44:04 +00:00
Alicia Boya García
65dcb2adbf gstbasesink: Include segment.offset in the computation of position
Position queries with GST_FORMAT_TIME are supposed to return stream
time.

gst_base_sink_get_position() estimates the current stream time on its
own instead of using gst_segment_to_stream_time(), but the algorithm
used was not taking segment.offset into account, resulting in invalid
values when this field was set to a non-zero value.

https://bugzilla.gnome.org/show_bug.cgi?id=792434
2018-02-16 10:35:14 -03:00
Mathieu Duponchelle
5ce6487fa9 basetransform: annotate virtual methods 2018-01-31 13:36:15 +01:00
Mathieu Duponchelle
117200faeb aggregator: delegate buffer skipping to the aggregate thread
As we do that for serialized events as well, and the subclass will
most likely need to access pad->segment to make its decisions,
doing that from the sinkpad's streaming threads was racy.
2018-01-23 22:49:52 +01:00
Mathieu Duponchelle
9f69034d41 API: GstAggregatorPad.skip_buffer virtual method
Allows subclasses to prevent buffers from being queued.

https://bugzilla.gnome.org/show_bug.cgi?id=781928
2018-01-23 20:17:44 +01:00
Mathieu Duponchelle
ac7434088e basesrc: Annotate some of the virtual methods 2018-01-23 20:06:52 +01:00
Tim-Philipp Müller
bce246f39f aggregator: rename _get_buffer() -> _peek_buffer() and _steal -> _pop
https://bugzilla.gnome.org/show_bug.cgi?id=791204
2018-01-23 09:44:44 +00:00
Jun Xie
33e7269c37 typefindhelper: fix confusing debug log message
In case of a short buffer, the debug log is quite confusing.
Distinguish the two types of failure cases to make it clearer.

https://bugzilla.gnome.org/show_bug.cgi?id=792486
2018-01-15 16:31:44 +00:00
Stefan Sauer
ce00ec8bce aggregator: remove DEBUG_FUNCPTR
The new gst_element_do_foreach_pad() does not print the functions anymore.
2017-12-26 12:53:25 +01:00
Jan Alexander Steffens (heftig)
4636477d81 aggregator: Avoid a maybe-uninitialized warning
Arch Linux x86_64, gcc 7.2.1-2, -Og -g3
2017-12-24 11:39:14 +01:00
Nicolas Dufresne
443221c661 basetransform: Allow going passthrough inside decide_allocation
Sub-class may want to decide to go passthrough/in-place by inspecting
the support meta APIs. This patch duplicates the check for this mode,
so we still don't do uneeded allocation query while we allow sub-classes
to switch the behaviour during it's own decide_allocation call.

Notice that such sub-class need to reset the class to non-passthrough in
set_caps() in order for decide_allocation to be called again. This is
needed otherwise we'd be doing an allocation query in element in which
it make no sense (notably capsfilter).

https://bugzilla.gnome.org/show_bug.cgi?id=791453
2017-12-17 15:39:51 -05:00
Tim-Philipp Müller
18fe36a286 basesrc: add buffer list support
Add a gst_base_src_submit_buffer_list() function that allows subclasses
to produce a bufferlist containing multiple buffers in the ::create()
function. The buffers in the buffer list will then also be pushed out
in one go as a GstBufferList. This can reduce push overhead
significantly for sources with packetised inputs (such as udpsrc)
in high-throughput scenarios.

The _submit_buffer_list() approach was chosen because it is fairly
straight-forward, backwards-compatible, bindings-friendly (as opposed
to e.g. making the create function return a mini object instead),
and it allows the subclass maximum control: the subclass can decide
dynamically at runtime whether to return a list or a single buffer
(which would be messier if we added a create_list virtual method).

https://bugzilla.gnome.org/show_bug.cgi?id=750241
2017-12-07 12:17:09 +00:00
Tim-Philipp Müller
880c573e8d basesrc: minor code readability improvement 2017-12-07 12:17:09 +00:00
Tim-Philipp Müller
76b54099bd aggregator: add finish_buffer() vfunc
So subclasses can override the finish behaviour
and/or decorate or modify buffers before they
get pushed out.

https://bugzilla.gnome.org/show_bug.cgi?id=760981
2017-12-04 15:27:04 +00:00
Tim-Philipp Müller
e9483fbffb aggregator: disable tag merging and forwarding for now
Subclasses should handle this for now.
2017-12-04 12:29:05 +00:00
Tim-Philipp Müller
e6dbbb3854 aggregator: hook up to docs 2017-12-02 19:00:32 +00:00
Tim-Philipp Müller
cea9641fa9 aggregator: hook up to build system
https://bugzilla.gnome.org/show_bug.cgi?id=739010
2017-12-02 15:44:40 +00:00
Tim-Philipp Müller
39664da1f0 Move GstAggregator from -bad to core
Merge branch 'aggregator-move'

https://bugzilla.gnome.org/show_bug.cgi?id=739010
2017-12-02 15:27:22 +00:00
Mathieu Duponchelle
79d0239e2f aggregator: Remove klass->sinkpads_type
This posed problems for the python bindings (and possibly others).

Instead, subclasses now use add_pad_template_with_gtype.

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-12-02 15:10:27 +00:00
Tim-Philipp Müller
4e4438de21 aggregator: add doc blurb for gst_aggregator_pad_is_eos() 2017-12-02 15:10:27 +00:00
Tim-Philipp Müller
41f7b04c81 aggregator: also remove now-unused PadForeachFunc declaration
https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-12-02 15:10:27 +00:00
Olivier Crête
e9fafb3e17 aggregator: Remove pad iterator function
Use new gst_element_foreach_sink_pad() from core instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-12-02 15:10:27 +00:00
Tim-Philipp Müller
2f3fbf24bc aggregator: use new gst_element_foreach_sink_pad()
Instead of gst_aggregator_iterate_sinkpads() which will
soon be removed.

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-12-02 15:10:27 +00:00
Stefan Sauer
f51557dbc5 aggregator: add more comments 2017-12-02 15:10:27 +00:00
Stefan Sauer
063787d770 aggregator: fix type for latency property (int64 -> GStClockTime)
The value is used as GstClockTiem in the code. Adapt the hack^H^H^H^Hcode
in live-adder.
2017-12-02 15:10:27 +00:00
Olivier Crête
3d0dad59a0 aggregator: Don't take flush lock from output thread
Instead just take it in the chain function.

https://bugzilla.gnome.org/show_bug.cgi?id=784911
2017-12-02 15:10:27 +00:00
Olivier Crête
8b60b25917 aggregator: Don't block if adding to the tail of the queue
If we're adding to the tail of the queue, it's because we're converting
a gap event, so don't block there it means we're calling from the output
thread.

https://bugzilla.gnome.org/show_bug.cgi?id=784911
2017-12-02 15:10:27 +00:00
Stefan Sauer
a083391fb5 aggregator: review code related to time level
Add a comment for when the state matters. Use a local var for priv in
update_time_level() to improve readability. Move the our_latency local
var below the query results checks.
2017-12-02 15:10:27 +00:00
Stefan Sauer
23692ee688 aggregator: init latency values with 0 instead of FALSE 2017-12-02 15:10:27 +00:00
Stefan Sauer
fb3c9f3808 aggregator: code cleanup for event and query func
Only look up klass for non serialized events/queries. For events remove
superfluous assignment for the return value in the flushing case.
2017-12-02 15:10:27 +00:00
Stefan Sauer
8776900cf7 aggregator: simplify pad_event_func for FLUSH_STOP events
We want to skip serialization for FLUSH_STOP events (apparently). We can
simplify the code to add it to the top-level conditions. There was nothing
done in the first code path if the event was FLUSH_STOP.
2017-12-02 15:10:27 +00:00
Stefan Sauer
5509920c27 aggregator: drop special casing for eos
Just queue it like any other serialized event. This way we don't need to
check if there still are buffers in the queue.

Validated with the tests and gst-launch-1.0 pipelines.
2017-12-02 15:10:27 +00:00
Stefan Sauer
113a2c508b aggregator: add a doc-blob for the event_func 2017-12-02 15:10:27 +00:00
Stefan Sauer
45cef5726f aggregator: rename a local variable
The variable tracks wheter the queue is not empty, but num_buffers==0. That
means we have events or queries to process. Rename accordingly.
2017-12-02 15:10:27 +00:00
Stefan Sauer
498cdd8fac aggregator: remove commented code
The SEGMENT_DONE event does not require any special treatment. This is
commented out in 6efc106a67.
2017-12-02 15:10:27 +00:00
Stefan Sauer
656a2616f2 aggregator: move the comment for the locks to the lock macros
Looks like some code was inserted afterwards.
2017-12-02 15:10:27 +00:00
Stefan Sauer
5a06c3d12b aggregator: improve section docs
Mention how data ends up in the queues. Document the relation of the pad
functions and the class vmethods to get events and queries.
2017-12-02 15:10:27 +00:00
Stefan Sauer
4808f4836c aggregator: cleanup event forwarding
Don't copy the whole event struct. Set the input params when we call the
forwarding helper. Initialize the internal fields and return values in the
helper.
2017-12-02 15:10:27 +00:00