Commit graph

321 commits

Author SHA1 Message Date
Nirbheek Chauhan
b395c055eb videoaggregator: add "ignore-eos" property for input pads
When set, it causes videoaggregator to repeatedly aggregate the last buffer on
an EOS pad instead of skipping it and outputting silence. This is useful, for
instance, while playing back files seamless one after the other, to avoid
videoaggregator ever outputting silence (the checkerboard pattern).

It is to be noted that if all the pads on videoaggregator have this property set
on them, the mixer will never forward EOS downstream for obvious reasons. Hence,
at least one pad with 'ignore-eos' set to FALSE must send EOS to the mixer
before it will be forwarded downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=748946
2015-06-12 19:44:50 +01:00
Thiago Santos
7b8d819d18 videoaggregator: simplify aggregate returning
Rework special handling with goto/labels to only have one case
and otherwise just return normally.
2015-06-08 12:35:25 -03:00
Thiago Santos
443a3beb8f videoaggregator: refactor caps reconfigure to its own function
Makes the aggregation code shorter and easier to read
2015-06-08 12:34:23 -03:00
Thiago Santos
9f9c723f5d videoaggregator: fixing types in aggregate function
Correctly use boolean and GstFlowReturn types in the function.
2015-06-08 12:33:40 -03:00
Thiago Santos
a5e1f26385 videoaggregator: use macro to access aggregator src pad
Makes code a bit more readable
2015-06-08 12:09:51 -03:00
Jan Schmidt
37298354ff videoaggregator: Add class property to disable caps scaling
Add preserve_update_caps_result boolean on the class to allow
sub-classes to disable videoaggregator removing sizes and framerate
from the update_caps() return result.
2015-05-30 01:33:49 +10:00
Jan Schmidt
6dabd46a2d videoaggregator: Catch errors, and allow sub-class to return NULL from get_output_buffer()
A return value of GST_FLOW_OK with a NULL buffer from get_output_buffer()
means the sub-class doesn't want to produce an output buffer, so
skip it.

If gst_videoaggregator_do_aggregate() generates an error, make sure
to propagate it - don't just ignore and discard the error by
over-writing it with the gst_pad_push() result.
2015-05-30 01:33:49 +10:00
Matthew Waters
0871b7b43d compositor: implement proper par handling
We were previously failing on different input and output par
2015-05-14 14:58:07 +10:00
Guillaume Desmottes
89e2a5fe75 videoaggregator: fix caps leak when early returning
https://bugzilla.gnome.org/show_bug.cgi?id=747993

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-17 14:45:05 +01:00
Sebastian Dröge
9592a0c32f videoaggregator: Remove broken timestamps-going-backwards check
This would've also triggered if for some reason the segment was updated
in such a way that PTS went backwards, but the running time increased. Like
what happens when non-flushing seeks are done.

We're doing a proper buffer-from-the-past check a few lines below based on the
running time, which is the only time we should care about here.
2015-04-08 19:31:43 -07: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
Nirbheek Chauhan
dceb8aefd1 videoaggregator: Document why buffer_vinfo is needed 2015-03-24 14:54:33 +01:00
Nirbheek Chauhan
802a29eb48 videoaggregator: Check if there's a previous buffer to 'keep'
If we want to keep a previous buffer but there's no previous buffer, we actually
need more data instead.
2015-03-24 14:54:33 +01:00
Nirbheek Chauhan
74a9cd58cd videoaggregator: While aggregating, sync values for all pads before converting frames 2015-03-12 09:47:50 +00:00
Sebastian Dröge
50d2d9ac08 Revert "videoaggregator: Create new caps from the video-info"
This reverts commit 78215be0df.

because it broke glvideomixer with custom caps features.
2015-03-06 18:53:13 +01:00
Sebastian Dröge
78215be0df videoaggregator: Create new caps from the video-info
In case the original caps were missing some optional fields like
interlace-mode. We assume default values for those everywhere,
but they can still cause negotiation to fail if a downstream element
expects the field to be there and at a specific value.
2015-03-06 14:36:26 +01:00
Tim-Philipp Müller
54d288fc19 videoaggregator: use new gst_aggregator_pad_drop_buffer() 2015-02-13 16:25:52 +00:00
Sebastian Dröge
037928dcf6 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 14:16:21 +01:00
Sebastian Dröge
a8033553f9 videoaggregator: When receiving timeout before caps, make sure to also advance our frame counter
Otherwise we will directly go EOS on the next non-timeout.
2015-02-10 10:57:38 +01:00
Matthew Waters
783245f1fe videoaggregator: fix buffer selection when duration=-1
If the src framerate and videoaggreator's output framerate were
different, then we were taking every single buffer that had duration=-1
as it came in regardless of the buffer's start time.  This caused the src
to possibly run at a different speed to the output frames.

https://bugzilla.gnome.org/show_bug.cgi?id=744096
2015-02-10 14:44:21 +11:00
Tim-Philipp Müller
6725ff5598 videoaggregator: don't set element factory details
This is an abstract base class, not an element.
2015-02-08 14:32:22 +00:00
Thibault Saunier
ccf329d527 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
2015-01-29 10:24:18 +01:00
Thibault Saunier
d8eef43123 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
2015-01-29 10:24:18 +01:00
Olivier Crête
41d26673d6 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
2015-01-29 10:24:18 +01:00
Olivier Crête
ee04b09233 videoaggregator: Lock access to members of GstAggregatorPad
Take the pad's object lock before accessing members of the
GstAggregatorPad structure.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Nirbheek Chauhan
878b53f8fc videoaggregator: If getting a timeout before having caps, just advance our position
This can happen if this is a live pipeline and no source produced any buffer
and sent no caps until an output buffer should've been produced according to the
latency.

This fix is similar in spirit to commit be7034d1 by Sebastian for audiomixer.
2015-01-29 09:47:32 +01:00
Tim-Philipp Müller
21168dd199 videoaggregator: fix crash when receiving buffer without timestamps
Unset out buffer in clip function when we unref the buffer to be
clipped, otherwise aggregator will continue to use the already-
freed buffer. Fixes crash when buffers without timestamps are
being fed to aggregator. Partly because aggregator ignores the
error flow return.

https://bugzilla.gnome.org/show_bug.cgi?id=743334
2015-01-26 09:24:40 +00:00
Stefan Sauer
4732962c85 gitignore: ignore more files 2015-01-12 22:52:36 +01:00
Tim-Philipp Müller
6fc474c30a videoaggregator: update for aggregator start/stop vfunc change 2014-12-30 17:56:35 +00:00
Tim-Philipp Müller
83de85a2f3 aggregator: make padding larger
Esp. the class structures, can't have enough
spare space for virtual functions.
2014-12-28 01:13:33 +00:00
Sebastian Dröge
ad9fe1fe7b videoaggregator: Use the src query implementation of aggregator as the default case 2014-12-22 22:12:02 +01:00
Sebastian Dröge
30ce523d59 videoaggregator: Don't try to map NULL buffers 2014-12-18 22:04:38 +01:00
Sebastian Dröge
af46a58cae videoaggregator: Make sure to always update the pad's videoinfo together with buffers
Otherwise the videoinfo and the buffer content can go out of sync.
2014-12-18 22:03:04 +01:00
Sebastian Dröge
06a4e80be9 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.
2014-12-17 19:51:32 +01:00
Sebastian Dröge
d4c4af699e 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.
2014-12-17 18:41:41 +01:00
Matthew Waters
8bf53a1226 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
2014-12-16 16:58:57 +01:00
Matthew Waters
a7e86751bf videoaggregator: always try to use newer buffers
instead of dropping them for being too old.  This ensures that
the newest buffer is always used for rendering
2014-12-16 16:49:49 +01:00
Thibault Saunier
aa25d0ab4c videoaggregator: Hide some more fields from the API
+ Add some documentation
2014-12-12 11:49:42 +01:00
Sebastian Dröge
8a8444ebe7 videoaggregator: Failure to map a video frame is not just a warning 2014-11-28 10:22:44 +01:00
Sebastian Dröge
1200f2f94b videoaggregator: Minor cleanup 2014-11-27 21:23:36 +01:00
Sebastian Dröge
fbf7595ca8 videoaggregator: Copy over more fields from the relevant video-info
gst_video_info_set_format() will reset the complete video-info, but
we want to keep values like the PAR, colorimetry and chroma site.
Otherwise we risk setting different values on the srcpad caps than
what is actually inside the buffers.
2014-11-27 20:34:25 +01:00
Sebastian Dröge
b301cb1fc9 videoaggregator: Directly use the converters video-info instead of recalculating it 2014-11-27 20:25:29 +01:00
Sebastian Dröge
11740d78b1 videoaggregator: Do source pad negotiation only from the aggregated function
Otherwise we might negotiate from the sinkpad streaming threads at
the same time as on the srcpad streaming thread, and then all kinds
of crazy bugs happen that don't make any sense at all.
2014-11-27 19:54:10 +01:00
Thibault Saunier
a61d2e4e07 videoconvert: Hide all conversion related fields
And do not delay the setting of the conversion_info

https://bugzilla.gnome.org/show_bug.cgi?id=740768
2014-11-27 19:10:58 +01:00
Thibault Saunier
9d8055186d videoaggregator: Expose vmethods to set converters and prepare/clean frames
This gives more flexibility to the subclasses and permits to remove the
GstVideoAggregatorClass->disable_frame_conversion ugly API.

WARNING: This breaks the API as it removes the disable_frame_conversion
field

API:
  + GstVideoAggregatorClass->find_best_format
  + GstVideoAggregatorPadClass->set_format
  + GstVideoAggregatorPadClass->prepare_frame
  + GstVideoAggregatorPadClass->clean_frame

  - GstVideoAggregatorClass->disable_frame_conversion

https://bugzilla.gnome.org/show_bug.cgi?id=740768
2014-11-27 19:10:58 +01:00
Thibault Saunier
c7b7f98df2 videoaggregator: Let a full renegotiation happen after removing the last pad
With the current code, we will end up setting the preferred downstream
format as the srcpad format, and it might not be accepted by the next
sinkpad to be added. We should instead let the next sinkpad reconfigure
everything.
2014-11-27 19:10:58 +01:00
Sebastian Dröge
3d38dff076 videoaggregator: Also sync pad properties to the controller if conversion is disabled 2014-11-26 13:06:21 +01:00
Sebastian Dröge
6c0d01ce17 videoaggregator: Don't output 0-duration buffers at the segment end
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2014-11-19 17:06:52 +01:00
Matthew Waters
f4a10c64c8 videoaggregator: fix up QoS handling for live sources
Only attempt adaptive drop when we are not live

https://bugzilla.gnome.org/show_bug.cgi?id=739996
2014-11-17 22:39:07 +11:00
Sebastian Dröge
9f09b6ff0b videoaggregator: Swap source/destination parameters of gst_video_converter_frame() 2014-11-03 16:13:23 +01:00