Commit graph

57 commits

Author SHA1 Message Date
Sebastian Dröge
d9a267f030 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
0d89c672e8 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
b4ee792fc2 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
bde4292e90 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
490444637f 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
83e1895dbf 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
008de39d3f 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
f5d63b031d 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
4527811b1f 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
38a06d0a33 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
Tim-Philipp Müller
b8e97659fe videoaggregator: update for aggregator start/stop vfunc change 2014-12-30 17:56:35 +00:00
Sebastian Dröge
b9312fe9a2 videoaggregator: Use the src query implementation of aggregator as the default case 2014-12-22 22:12:02 +01:00
Sebastian Dröge
5c9472f78c videoaggregator: Don't try to map NULL buffers 2014-12-18 22:04:38 +01:00
Sebastian Dröge
ccd24a3577 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
6f0eb92d72 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
26d1a22e90 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
e354149436 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
8fe8510d80 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
e8fda3a28a videoaggregator: Hide some more fields from the API
+ Add some documentation
2014-12-12 11:49:42 +01:00
Sebastian Dröge
6354e0235a videoaggregator: Failure to map a video frame is not just a warning 2014-11-28 10:22:44 +01:00
Sebastian Dröge
0b73de023c videoaggregator: Minor cleanup 2014-11-27 21:23:36 +01:00
Sebastian Dröge
fdc87a52f2 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
4233ba4ca4 videoaggregator: Directly use the converters video-info instead of recalculating it 2014-11-27 20:25:29 +01:00
Sebastian Dröge
00880b5830 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
ec45cbda22 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
8cc214fdb8 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
a806b40135 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
fc593bd2ca videoaggregator: Also sync pad properties to the controller if conversion is disabled 2014-11-26 13:06:21 +01:00
Sebastian Dröge
f2364cb398 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
0ec9bf6140 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
22825010c3 videoaggregator: Swap source/destination parameters of gst_video_converter_frame() 2014-11-03 16:13:23 +01:00
Luis de Bethencourt
2bf4a94179 videoaggregator: remove storage of never used values
These two values are stored just before the function returns and they go out of
scope.
2014-10-30 14:52:13 +00:00
Matthew Waters
165cdd20a7 videoaggregator: fixate the parts of the caps we don't know how to deal with
fixes glvideomixer with video/x-raw,width=foo i.e. no format field.
2014-10-21 02:53:02 +11:00
Matthew Waters
8bf2acba1d videoaggregator: operate on caps rather than video info
Otherwise the CapsFeatures will be lost along with the possibility
of multiple output types and formats.

https://bugzilla.gnome.org/show_bug.cgi?id=738129
2014-10-21 01:14:36 +11:00
Matthew Waters
b30f8985d5 aggregator: add latency query handling 2014-10-09 23:52:11 +11:00
Matthew Waters
9aa89185ed videoaggregator: support unresponsive pads
Render unresponsive pads with the last video frame received.
2014-10-09 23:52:11 +11:00
Matthew Waters
1e84482f36 videoaggregator: remove the use of the queued buffer on sink pads
That data is now held by the aggregator class
2014-10-09 23:52:11 +11:00
Thibault Saunier
138e63fd52 videoaggregator: Do not wrongly set the aggregator.segment
The aggregator.segment is not to be initialized by the subclasses but
by the aggregator itself. Moreover, initializing it on start would make
us loose the information coming from the initial seek.
2014-10-06 18:57:28 +02:00
Thibault Saunier
47aea18826 videoaggregator: Make sure not to unref a NULL pointer 2014-10-06 18:57:28 +02:00
Sebastian Dröge
9e122f6442 videoaggregator: Unmap and free GstVideoFrames as needed after conversion and errors 2014-10-06 10:11:47 +03:00
Thibault Saunier
d2f4d20d85 videoaggregator: Do not to release VIDEO_AGGREGATOR_LOCK while setting format info
We should be able to always keep the VIDEO_AGGREGATOR_LOCK while
negotiating caps, this patch introduce that change.

That also implies that we do not need the SETCAPS_LOCK anymore because
now VIDEO_AGGREGATOR_LOCK guarantees that setcaps is not called from
several threads and the gst_aggregator_set_caps method is now
protected.

https://bugzilla.gnome.org/show_bug.cgi?id=735042
2014-10-03 13:18:05 +02:00
Sebastian Dröge
6daef6a2f8 videoaggregator: Also copy over the chroma siting and colorimetry when deciding on a conversion 2014-10-01 17:22:59 +03:00
Sebastian Dröge
f4451b764f videoaggregator: Revert the last commit and handle resolutions differences properly
This is about converting the format, not about converting any widths and
heights. Subclasses are expected to handler different resolutions themselves,
like the videomixers already do properly.
2014-10-01 17:18:05 +03:00
Sebastian Dröge
30f6b63c3d videoaggregator: GstVideoConverter currently can't rescale and will assert
Leads to ugly assertions instead of properly erroring out:
CRITICAL **: gst_video_converter_new: assertion 'in_info->width == out_info->width' failed
2014-10-01 17:11:16 +03:00
Matthew Waters
62a430ad21 videoaggregator: don't create converters when the subclass doesn't want them
fixes a critical with glvideomixer after
35bd1969f9

CRITICAL **: gst_video_converter_new: assertion 'in_info->width == out_info->width' failed
2014-09-28 16:58:42 +10:00
Wim Taymans
e4dd599a55 video: use video lib conversion code instead of copy 2014-09-24 16:55:49 +02:00
Matthew Waters
4b1bf9b52a 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
2014-08-11 23:36:27 +10:00
Sebastian Rasmussen
bc15905c45 videoaggregator: Unref allowed caps after usage
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734522
2014-08-10 11:55:09 +01:00
Thibault Saunier
4e60b291f8 videoaggregator: Fix some more the locking logic in update_src_caps
We need the GST_OBJECT_LOCK only to iterate the sinkpads, nothing else.

https://bugzilla.gnome.org/show_bug.cgi?id=732750
2014-07-06 23:36:10 +02:00
Tim-Philipp Müller
27ad5ef8d6 videoaggregator: fix broken locking in update_src_caps function
We would unlock an already-unlocked mutex that we never re-locked.

https://bugzilla.gnome.org/show_bug.cgi?id=732750
2014-07-06 22:16:48 +01:00