Commit graph

140 commits

Author SHA1 Message Date
Sebastian Dröge
76364ebfe7 videoencoder: Also don't request a new key-unit if we already got one after the requested running time
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
19fecabdf7 videoencoder: Don't request another keyunit if another one is pending or we requested one for a future time already
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
c5b081edc2 videoencoder: Add min-force-key-unit-interval property
This allows configuring the minimum interval between subsequent
force-key-unit requests and prevents a big bitrate increase if a lot of
key-units are requested.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
6260c4be7e videoencoder: When pushing headers as part of a keyframe mark the first header as keyframe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
401d56a6a7 videoencoder: Handle all matching force-keyunit events at once
Previously we only handled one event at a time, which could lead to the
following two suboptimal situations:
- frame 0 at 20ms, frame 1 at 40ms and two force-keyunit events at 10ms
  and 15ms. We would create a new keyframe for both of the frames.
- 100 force-keyunit events with running-time NONE would cause all
  following 100 frames to be made into a keyframe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
9b1f1f431a videoencoder: Sort force-keyunit-events by their running time
That way we can more easily work with the whole list without iterating
over all of the elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
fb7ab33e03 videoencoder: Simplify header buffer metadata updating
Instead of doing a shallow copy of the list just to call make_writable()
on each buffer, do that inline in the same loop and modify the list
contents.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/683>
2020-06-03 16:21:41 +03:00
Sebastian Dröge
caaa5ac864 video: Use GQueue instead of plain GList in a few places
Also not optimal but at least simplifies the code a bit and doesn't
require g_list_length() and g_list_append() in a few places.

For 2.0 there are some more candidates to change but unfortunately
they're currently part of the API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/683>
2020-06-03 16:21:41 +03:00
Stéphane Cerveau
ac6b805827 videoencoder: subclass 'set_format' should be optional
Aligns documentation with the code to make the subclass
'set_format' call optional.
2020-04-01 17:47:04 +02:00
Stéphane Cerveau
19f27f94ee videoencoder: protect the use of num_subframes
change stream lock location to protect the use of
frame->abidata.ABI.num_subframes
2020-02-24 20:37:38 +00:00
Devarsh Thakkar
8df947df5d videoencoder: Release stream lock in finish_subframe before pad_push
Derived from 780d635dadc0723e39a8ba90cfe0903a2de346fd for
https://bugzilla.gnome.org/show_bug.cgi?id=715192
which was for finish_frame.
2020-02-24 20:37:38 +00:00
Stéphane Cerveau
6cfdeb7423 videoencoder: send new headers in finish_frame
If headers have been set by subclass, this headers should be sent
for a first time or on demand with a key-unit
2019-12-21 02:59:14 +00:00
Stéphane Cerveau
7013a58874 videoencoder: Use video marker flag to signal end of frame
This marker is optional, its name refer to RTP marker bit. This mark can
be use to reduce latency in various use cases. With the split between
finish_frame() and finish_subframe() we will now be able to identitfy
the last subframe with no latency.

In order to detail the use of GST_BUFFER_FLAG_MARKER in a video
use case, the flag GST_VIDEO_BUFFER_FLAG_MARKER has been introduced
with a proper documentation clarifying marker's role.
2019-12-21 02:59:14 +00:00
Guillaume Desmottes
3e32896912 videoencoder: add API to push subframes
Introduce a new API so encoders can split the encoding in subframes.
This can be useful to reduce the overall latency as we no longer need to
wait for the full frame to be encoded to start decoding or sending it.
2019-12-21 02:59:14 +00:00
Guillaume Desmottes
789803fd6d videoencoder: factor out logic from gst_video_encoder_finish_frame()
No semantic change, I'm going to reuse all those functions in a new
finish_slice() methods.
2019-12-21 02:59:14 +00:00
Olivier Crête
6b283d9e78 Revert "videoencoder: factor out logic from gst_video_encoder_finish_frame()"
This reverts commit b1ec312b8e.
2019-12-19 17:52:12 -05:00
Stéphane Cerveau
b1ec312b8e videoencoder: factor out logic from gst_video_encoder_finish_frame()
No semantic change, I'm going to reuse all those functions in a new
finish_slice() methods.
2019-12-19 21:59:10 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Thibault Saunier
287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00
Seungha Yang
4e80ea6473 videoencoder: Forward upstream HDR information to downstream
... if subclass didn't update values. Note that the mastering-display-info
and content-light-level might be updated by user defined value (e.g., encoding option).
2019-05-02 14:35:27 +09:00
Sebastian Dröge
03a85de734 libs: Fix various Since markers 2019-04-23 12:28:26 +00:00
Alexey Chernov
595dd27ede videoencoder: Release STREAM_LOCK during gst_pad_push()
Release STREAM_LOCK before calling gst_pad_push() and take it
back afterward so that upstream isn't blocked while output
buffer is being pushed downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=715192
2018-08-31 16:11:04 -04:00
Tim-Philipp Müller
18c457dfb4 video: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 21:59:13 +02:00
Edward Hervey
1208ef637a videoencoder: Keep the segment position in sync
If the start of the segment is modified, the position should be
modified accordingly

https://bugzilla.gnome.org/show_bug.cgi?id=796576
2018-06-13 13:20:44 +02:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Guillaume Desmottes
7950a4614c videoencoder: add qos property
This new property control if the encoder base class should gather QoS
stats and if subclasses should use them by dropping late frames.

https://bugzilla.gnome.org/show_bug.cgi?id=789467
2017-10-25 14:22:15 +02:00
Matthew Waters
a240880664 Revert "videoencoder: flush encoder in transition PAUSED->READY"
This reverts commit 877664a414.
2017-10-22 01:00:10 +11:00
Nicola Murino
877664a414 videoencoder: flush encoder in transition PAUSED->READY
https://bugzilla.gnome.org/show_bug.cgi?id=787311
2017-10-20 01:55:19 +11:00
Nicola Murino
6627dd3ae3 videoencoder: remove the lock from gst_video_encoder_flush
The lock is already taken before calling the flush method and can lead to
deadlock for some encoders that need to take the same lock from another
thread while flushing

https://bugzilla.gnome.org/show_bug.cgi?id=787311
2017-10-20 01:55:10 +11:00
Guillaume Desmottes
bcca3b926c videoencoder: implement QoS
It allows encoders to detect and drop input frames which are already
late to increase the chance of the pipeline to catch up.

The QoS logic and code is directly copied from gstvideodecoder.c.

https://bugzilla.gnome.org/show_bug.cgi?id=582166
2017-10-19 16:26:22 +02:00
Reynaldo H. Verdejo Pinochet
e81c334ca9 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 14:31:18 -07:00
Sebastian Dröge
a3656ba29b libs: Check if meta transform_func is NULL before using it
https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:31:14 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Sebastian Dröge
681d97aed7 video: Handle errors in gst_video_info_set_format() / gst_video_info_align()
https://bugzilla.gnome.org/show_bug.cgi?id=774588
2016-11-24 15:06:39 +02:00
Sebastian Dröge
ad06b54443 videoencoder: Proxy colorimetry and chroma-site from input to output caps
https://bugzilla.gnome.org/show_bug.cgi?id=771376
2016-11-01 20:40:07 +02:00
Sebastian Dröge
635d1a2a98 videoencoder: Proxy interlace-mode and field-order fields from the input to the output caps
https://bugzilla.gnome.org/show_bug.cgi?id=771376
2016-11-01 20:40:07 +02:00
Sebastian Dröge
3cabd3fe55 videoencoder: Use the object lock to protect bytes/time tracking 2016-07-04 10:52:24 +02:00
Sebastian Dröge
d8111778bd videoencoder/decoder: Move conversion utility functions to a common header and use consistently in encoder/decoder 2016-07-04 10:47:36 +02:00
Víctor Manuel Jáquez Leal
b4a695cd11 libs: video: split allocation query caos and pad caps
Since the allocation query caps contains memory size and the pad's caps
contains the display size, a video encoder or decoder might need to allocate
a different frame size than the size negotiated in the caps.

This patch splits this logic distinction for videodecoder and videoencoder.

The user if needs a different allocation caps, should set the allocation_caps
in the GstVideoCodecState before calling negotiate() vmethod. Otherwise the
allocation_caps will be the same as the caps set in the src pad.

https://bugzilla.gnome.org/show_bug.cgi?id=764421
2016-04-05 11:32:50 +02:00
Stian Selnes
85f297d648 videoencoder: Fix leak when pre_push does not return OK
https://bugzilla.gnome.org/show_bug.cgi?id=761951
2016-02-13 10:09:45 -03:00
Thibault Saunier
7d35a07f1a Revert "videoencoder: Release video frame when ->handle return ERROR or DROPPED"
This reverts commit 63517d0ed3.

It was wrong ref counting wise and we decided to deprecated DROPPED
return value

https://bugzilla.gnome.org/show_bug.cgi?id=760666
2016-01-20 09:50:17 +02:00
Thibault Saunier
63517d0ed3 videoencoder: Release video frame when ->handle return ERROR or DROPPED
https://bugzilla.gnome.org/show_bug.cgi?id=760666
2016-01-16 08:53:35 +01:00
Sebastian Dröge
64301f1005 video(en|de)coder: Return TRUE when we consumed a tag event without creating a new event
Fixes spurious flow errors that especially break gst-validate.
2015-08-18 16:28:42 +03:00
Tim-Philipp Müller
c21a972421 videoencoder: fix tag handling
Merge upstream tags with encoder tags and update whenever
any of those changes.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-18 12:44:04 +01:00
Sebastian Dröge
f5eebb27a2 {audio,video}{en,de}oder: Also copy POOL metas and make sure to copy over metas when creating subbuffers
POOL meta just means that this specific instance of the meta is related to a
pool, a copy should be made when reasonable and the flag should just not be
set in the copy.
2015-07-01 10:58:07 +02:00
Sebastian Dröge
ceef2cc12d videoencoder: Add transform_meta() vfunc with default implementation
The default implementation copies all metadata without tags, and metadata
with only the video tag. Same behaviour as in GstVideoFilter.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 10:40:09 +02:00
Tim-Philipp Müller
5df6cc074f videoencoder: fix gtk-doc chunk for new function 2015-06-13 13:41:35 +01:00
Matej Knopp
dc7b254805 videoencoder: Add gst_video_encoder_set_min_pts()
For streams with reordered frames this can be used to ensure that there
is enough time to accomodate first DTS, which may be less than first PTS

https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:17:25 -04:00
Jan Schmidt
7c1da700c4 video: Add multiview/stereo support
Add flags and enums to support multiview signalling in
GstVideoInfo and GstVideoFrame, and the caps serialisation and
deserialisation.

videoencoder: Copy multiview settings from reference input state

Add gst_video_multiview_* support API and GstVideoMultiviewMeta meta

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2015-06-11 12:05:00 +10:00
Song Bing
992101f82a videoencoder: Keep sticky events around when doing a soft reset
The current code will first discard all frames, and then tries to copy
all sticky events from the (now discarded) frames. Let's change the order.

https://bugzilla.gnome.org/show_bug.cgi?id=746865
2015-03-27 09:46:28 +01:00