Commit graph

3074 commits

Author SHA1 Message Date
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
Matthew Waters
fa302587dd check/harness: fix transfer annotations on buffer passing functions 2017-12-13 11:23:03 +11: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
16d9954dd5 harness: make bindings use the GBytes variant for _take_all_data() 2017-12-05 16:42:57 +00:00
Havard Graff
e08834bff3 harness: use new take_all_data() function in _dump_to_file(). 2017-12-05 15:37:14 +00:00
Tim-Philipp Müller
d8e7fc40b1 harness: add gst_harness_take_all_data() + _take_all_data_as_{bytes,buffer}()
Convenience function to just grab all pending data
from the harness, e.g. if we just want to check if
it matches what we expect and we don't care about
the chunking or buffer metadata.

Based on patch by: Havard Graff <havard.graff@gmail.com>
2017-12-05 15:37:00 +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
Stefan Sauer
a82e6bc650 aggregator: simplify src_event
Avoid extra ref/unref, we have a ref and do_seek unrefs. Just return the result
as we have. This lets us remove the local var plus the label.
2017-12-02 15:10:27 +00:00
Stefan Sauer
70d0945b35 aggregator: register func for do_events_and_queries
This fixes logging the func ptr from _iterate_sinkpads().
2017-12-02 15:10:27 +00:00
Stefan Sauer
bedc9de46c aggregator: only set clipped_buffer to NULL if needed 2017-12-02 15:10:27 +00:00
Stefan Sauer
06d62ccb94 aggregator: rename check_events
This function also handles queries. Update the code to loop until all events and
queuries are handled.
2017-12-02 15:10:27 +00:00
Stefan Sauer
1869886a96 aggregator: add a few more comments to PadPrivate struct 2017-12-02 15:10:27 +00:00
Stefan Sauer
82bde3446d aggregator: rename buffers field to data
The queue stores buffers, events and queries.
2017-12-02 15:10:27 +00:00
Stefan Sauer
caafb59af5 aggregator: documentaion fixes
Fix typos and remove params docs, where the param was moved.
2017-12-02 15:10:27 +00:00
Stefan Sauer
2cd988e763 aggregator: log all events
We already log a few events explicitly, just log them all with more detail.
2017-12-02 15:10:27 +00:00
Tim-Philipp Müller
bb9f3d2be5 aggregator: fix header formatting 2017-12-02 15:10:27 +00:00
Sebastian Dröge
70b4395e95 aggregator: Remove the GAP event from the queue before queueing up the GAP buffer
Otherwise check_events() will not remove the GAP event (as the queue
tail is not the event anymore but the GAP buffer), then the GAP buffer
is handled, then the GAP event is handled again, ... forever.
2017-12-02 15:10:27 +00:00
Tim-Philipp Müller
e018273183 aggregator: mark symbols explicitly for export with GST_EXPORT 2017-12-02 15:10:27 +00:00
Stefan Sauer
27708ff7c1 aggregator: remove duplicated code fragment
This code already runs above when (event || query).
2017-12-02 15:10:27 +00:00
Stefan Sauer
b609fd7138 aggregator: code cleanups
Fix comment typos, some copy'n'paste in logging. Add more doc comments.
2017-12-02 15:10:27 +00:00
Mathieu Duponchelle
4f81aa8742 aggregator: Invalidate pad's tail position ...
when dequeuing a segment event.

https://bugzilla.gnome.org/show_bug.cgi?id=784593
2017-12-02 15:10:27 +00:00
Stefan Sauer
7b82eb546f aggregator: fix "'aggclass' may be used uninitialized in this function" 2017-12-02 15:10:27 +00:00
Olivier Crête
474acca0a8 aggregator: Process serialized queries through the queue
This ensures that they really get processed in order with
buffers. Just waiting for the queue to be empty is sometimes not
enough as the buffers are dropped from the pad before the result is
pushed to the next element, sometimes resulting in surprising
re-ordering.
2017-12-02 15:10:27 +00:00
Olivier Crête
0500807b55 aggregator: Set flow to FLUSHING on pad stop
Fixes a rare race where the pad is being stopped while doing a query.
2017-12-02 15:10:27 +00:00
Olivier Crête
a001f6d587 aggregator: Request pad templates which are not request pad
https://bugzilla.gnome.org/show_bug.cgi?id=782920
2017-12-02 15:10:27 +00:00