Commit graph

20916 commits

Author SHA1 Message Date
Mathieu Duponchelle
4aa72cea4f smartencoder: clean up and extend accepted formats
* Add support for H265

* Don't overwrite original codec_data / streamheader in the output
  caps, but instead allow them to change and send them to the
  combiner at the right moment: encoder caps, reencoded GOP,
  original caps, original GOP(s), and potentially encoder caps
  and rencoded last GOP.

* For H264 / H265, force usage of a format with inband SPS / PPS
  (avc3 / hev1), this is cleaner than misadvertising avc1, hvc1 and
  some muxers like mp4mux will actually advertise both differently.

  Unfortunately, while mp4 supports updating the codec_data and using
  avc1 with no in-band SPS / PPS updates, it turns out some decoders
  (eg chrome / firefox) don't handle this particularly well and stop
  decoding after the reencoded GOP. We could expose a switch to
  force usage of avc1 / hvc1 nevertheless, but for now stick to
  requiring that the parser output SPS / PPS in-band with
  config-interval=-1 (that has not changed)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1249>
2021-08-20 14:20:25 +00:00
Seungha Yang
1ae8b61ec0 compositor: Add "max-threads" property
Adding new property for user to be able to set expected the maximum
number of blend task threads. This can be useful in case that user
wants to restrict the number of parallel task runners for system
resource management or debugging/development purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1242>
2021-08-20 18:43:26 +09:00
Sebastian Dröge
bf71ef17e3 pbutils: Expose functions for getting a file extension for caps and flags for describing the format of the caps
This information was available internally already but not available from
the outside.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1221>
2021-08-18 12:06:16 +00:00
Sebastian Dröge
52bca104e4 playbin/uridecodebin: Emit source-setup signal early before doing the scheduling query
Some elements will require the source to be set up properly before the
scheduling query returns useful results, e.g. appsrc and giostreamsrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1241>
2021-08-18 09:07:07 +00:00
Devarsh Thakkar
297b1e68e2 ext: alsa: Fix fallback paths for setting buffer and period times
Below fallback paths were introduced in
9759810d82
if setting period time after buffer time failed :
1) Set period time and then buffer time if it doesn't work
2) Set only buffer time
3) Set only period time

These all were not functioning properly since they were using old
copy of snd_pcm_hw_params_t which already had some fields set
as per previous try and this was causing issues as driver was
referring to that old value while trying to set them again in
fallback paths.

So now we always use the initial copy of snd_pcm_hw_params_t
for every fallback  and same is also being done at
557c429510

Also we change the sequence to set period time earlier than
buffer time since period bytes being the smaller unit, most of the times
if underlying alsa device has a dependency then it is of period bytes
to be a multiple of some value (as per underlying DMA constraint)
and rest of the parameters like buffer bytes need to be adjusted
as per period bytes.

The same sequence is also followed in alsa-utils at
9b621eeac4

Fix 2) and 3) scenarios by returning success if the exclusive setting is passed
and not doing any further setting for buffer time or period time.

Add new fallback path of not setting any buffer time and period time
if all above fallback paths fail. The same is also being
followed at aforementioned pulseaudio commit.

In case of alsasink, remove the retry goto label, since it is not
required anymore as fallback paths take care of setting default
values if driver is not accepting any of the fallback paths.

Use separate label for exit to free params structs and return err
code. This also fixes leak in no_rate goto path in alsasink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1212>
2021-08-17 19:52:59 +00:00
Jakub Adam
b4a00f78bc videoencoder: pass upstream HDR information through codec state
Don't copy HDR metadata from sink pad, because its caps may not have
been set yet if GstVideoEncoder::negotiate is called from
GstVideoEncoder::set_format, as e.g. vpx encoder does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1175>
2021-08-17 14:54:06 +00:00
Jakub Adam
b3c7b9be49 videoutils: add HDR metadata fields to GstVideoCodecState
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1175>
2021-08-17 14:54:06 +00:00
Sebastian Dröge
a14f4f48c4 video-overlay-composition: Allow empty overlay compositions
Allowing to pass NULL to the constructor removes the need to
special-case the first rectangle in calling code and generally
simplifies application code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1256>
2021-08-16 21:13:27 +00:00
Per Förlin
535c02c73b gstrtspconnection: Add support to ignore x-server header reply
When connecting to an RTSP server in tunnled mode (HTTP) the server
usually replies with a x-server header. This contains the address
of the intended streaming server. However some servers return an
"invalid" address. Here follows two examples when it might happen.

1. A server use Apache combined with a separate RTSP process to handle
   Https request on port 443. In this case Apache handle TLS and
   connects to the local RTSP server, which results in a local
   address 127.0.0.1 or ::1 in the x-server reply. This address is
   returned to the actual RTSP client in the x-server header.
   The client will receive this address and try to  connect to it
   and fail.

2. The client use a ipv6 link local address with a specified scope id
   fe80::aaaa:bbbb:cccc:dddd%eth0 and connects via Http on port 80.
   The RTSP server receives the connection and returns the address
   in the x-server header. The client will receive this address and
   try to connect to it "as is" without the scope id and fail.

In the case of streaming data from RTSP servers like 1. and 2. it's
useful to have the option to simply ignore the x-server header reply
and continue using the original address.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1192>
2021-08-16 09:06:37 +00:00
Nirbheek Chauhan
3ced923da5 sdp: Avoid using g_memdup() since it is deprecated
g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib. Instead of using
g_memdup2(), we can simply use the new gst_buffer_new_memdup() added
in 1.19.x

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1254>
2021-08-13 19:35:23 +05:30
Matthew Waters
04856a3828 glbuffer: support persistent buffer mappings
Requires OpenGL 4.4 or EXT_buffer_storage

Current mesa exposes GL_ARB_buffer_storage when retrieving the relevant
functions returns no-ops and causes failures.

Improves throughput of uploads by roughly 30%-60% and download throughput by
roughly 10-30% across depending on the exact scenario and hardware.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1191>
2021-08-10 08:34:46 +00:00
Seungha Yang
8593e1517e examples: win32-videooverlay: Add support for testing gst_video_overlay_set_render_rectangle
Add keyboard handler to test gst_video_overlay_set_render_rectangle()
API for Windows video elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1235>
2021-08-02 18:32:22 +09:00
Seungha Yang
abe7bbf1d3 examples: win32-videooverlay: Use d3d11videosink by default
d3d11videosink was promoted to have primary rank and
it's recommended videosink element on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1235>
2021-07-30 23:04:57 +09:00
Seungha Yang
1da78d82c8 tests: appsink: Add reverse stepping test case
To demonstrate reverse stepping issue of
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/848

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1223>
2021-07-30 06:59:58 +00:00
Seungha Yang
f886766a6b examples: win32-videooverlay: Add test option for threading scenario
Add an option to test the case where window thread and pipeline handling
thread are different. Mainly to test the HWND leak fixed by
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2302

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1188>
2021-07-30 02:01:13 +09:00
Matthew Waters
32170aa6c2 rtpbasedepayload: remove object locking an extension
Doing that is fraught with danger of deadlocks and is not conceptually
part of the API contract.  The object lock is generally intended for
internal-object-use only.

If another lock is needed, that should be added separately.

This lock was erronously added as part of:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1118

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1233>
2021-07-28 04:16:58 +00:00
Matthew Waters
17cb683615 gldownload: use the GstGLSyncMeta in all cases
fixes qmlglsrc ! gldownload ! videoconvert in some cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1232>
2021-07-27 13:30:56 +10:00
Nicolas Dufresne
f136337970 glcontext: egl: Stop comparing native surface pointer
This was noticed with wayland, sometimes the newly create native
handle can have the same pointer (even though its new). This lead
to unwanted errors or crash.

Fixes #927

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:44:17 -04:00
Nicolas Dufresne
efa6d1c2f8 glwindow: Add "window-handle-changed" signal
This allow other objects to clear any wrapper object that depends
on the previous handle, and properly re-create the new wrappers without
having to resort into doing pointer comparison.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:44:11 -04:00
Nicolas Dufresne
f72b3cf199 Revert "glwindow: wayland: Skip redoing surfaces if window haven't changed"
This reverts commit aba6bd7822.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:40:14 -04:00
Guillaume Desmottes
c148ecf2cb appsrc: serialize custom events with buffers flow
Application may want to inject events to the pipeline and keep them
synchronized with the buffers flow.

Fix #247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:56:22 +02:00
Guillaume Desmottes
0a657d6db5 appsink: add API to catch events
There is currently no way for users to receive incoming events from
appsink while keeping them properly serialized with the buffers flow.
This can be especially useful when application is injecting custom
downstream events into the pipeline and needs to know when they reached
appsink.

Solving this by adding a new signal notifying about new incoming events
and a set of action signals and method to pull those events.
The API is actually pulling the samples and events all together as they
are actually fetched from the same queue.
Having a specific API to pull only events would have the side effect of
discarding samples (and pulling samples would discard events) making
this API not convenient for users.

Partially fix #247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:56:22 +02:00
Guillaume Desmottes
457e33fee5 appsink: factor out dequeue_object()
No semantic change, will be used to implement new event API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:53:53 +02:00
Nicolas Dufresne
aba6bd7822 glwindow: wayland: Skip redoing surfaces if window haven't changed
The problem is that EGLNativeWindowSurface and wl_egl_surface are the
same object underneath, so we must recreate both together. As an
optimization, the EGLNativeWindowSurface wrapper is only re-created
if the window_handle changed.

On Mesa, this would cause crash, which will be fixed by:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11979

And will lead to proper errors in the future or on other GL stack. This
issue was encounter using a permanent GstGLDisplay after cycling one of
multiple independent pipelines through NULL state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
Nicolas Dufresne
e97fda46dc glwindow: wayland: Remove redundant create_surfaces call
The surfaces will be created in _roundtrip_async, so no need to call
this early. This should cause no functional difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
Michael Olbrich
5bfb78aa28 decodebin3: improve decoder selection
Currently the decoder selection is very naive: The type with the highest
rank that matches the current caps is used. This works well for software
decoders. The exact supported caps are always known and the static caps are
defined accordingly.
With hardware decoders, e.g. vaapi, the situation is different. The decoder
may reject the caps later during a caps query. At that point, a new decoder
is created. However, the same type is chosen an after several tries,
decodebin fails.

To avoid this, do the caps query while adding the decoder and try again
with other decoder types if the query fails:

1. create the decoder from the next matching type
2. add and link the decoder
3. change the decoder state to READY
4. do the caps query
   if it fails then remove the decoder again and go back to 1.
5. expose the source pad
6. sync the decoder state with the parent.

This way, the decoder is already part of the pipeline when the state change
to READY happens. So context handling should work as before.

Exposing the source pad after the query was successful is important:
Otherwise the thread from the decoder source pad may block in a blocked pad
downstream in the playsink waiting for other pads to be ready.
The thread now blocks trying to set the state back to NULL while holding
the SELECTION_LOCK. Other streams may block on the SELECTION_LOCK and the
playsink never unblocks the pad. The result is a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1201>
2021-07-19 08:56:35 +00:00
Nicolas Dufresne
210cf85fdc gl: x11: Issue XSync to close our top level window
This is similar action as when the window handle is modified, we now issue
XSync whenever we destroy our internal window. This ensure that the window is
properly closed before the connecgtion is dropped.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne
3e69c5546b gl: wayland: Fix hinding the window on close()
When the window is called, we properly destroy all surfaces, which effectively
will unmap that surface and should make it disapear on screen, but we also
destroy the wl_source, a GSource that is resposibble of dispatching and executing
messages to/from the Wayland server.

As a side effect, the server never gets the message and the surfaces are
"leaked" on the server. We fix this using wl_display_flush() before destroying
the wl_source.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne
88e19f857a tests: example: Add missing glx_dep when building sdlshare
Might be realted to some recent Mesa cleanup, but GLX is not longer visible
through libOpenGL, so add the missing deps now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1227>
2021-07-15 11:11:00 -04:00
Matthew Waters
2ed12573b8 examples/qt/textureshare: add explicit dep on glx_dep
Fixes linking:

/usr/bin/ld: subprojects/gst-plugins-base/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.p/qglrenderer.cpp.o: undefined reference to symbol 'glXGetCurrentContext'
/usr/bin/ld: /usr/lib64/libGLX.so.0: error adding symbols: DSO missing from command line

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Haelwenn (lanodan) Monnier
e08dcdf622 gl: Try GLVND 'opengl' and 'glx' first
This fixes targetting desktop OpenGL without libGL.so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Sebastian Dröge
9243418a23 audioaggregator: Only post QoS messages if the property is enabled
Previously one of the branches did not check for the property value. To
avoid this in the future, check inside the QoS calculation function
instead.

As a side effect this now always prints the debug messages into the logs
when samples are dropped, which is useful information even without the
QoS messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Sebastian Dröge
71e46bcf38 audioaggregator: Resync on the next buffer when dropping a buffer on discont resyncing
If a buffer is dropped during resyncing on a discont because either its
end offset is already before the current output offset of the
aggregator or because it fully overlaps with the part of the current
output buffer that was already filled, then don't just assume that the
next buffer is going to start at exactly the expected offset. It might
still require some more dropping of samples.

This caused the input to be mixed with an offset to its actual position
in the output stream, causing additional latency and wrong
synchronization between the different input streams.

Instead consider each buffer after a discont as a discont until the
aggregator actually resynced and starts mixing samples from the input
again.

Also update the start output offset of a new input buffer if samples
have to be dropped at the beginning. Otherwise it might be mixed too
early into the output and overwrite part of the output buffer that
already took samples from this input into account.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/912
which is a regression introduced by https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1180/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Olivier Crête
e8b4164a1f audiomixer: Add test for QoS message posting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête
49f6d3bf33 audio aggregator: Post QoS message when dropping audio
Post a QoS message every time some audio samples are dropped.
Also print log messages to make it easier to debug

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête
ea516aee33 audio aggregator: Count samples that are dropped or processed
Keep a count of samples that are dropped or processed as statistics

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête
e3be1b8490 audio aggregator: Add QoS property to pad
Add a property to emit a QoS message whenever any data is dropped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête
1eff5ffef6 audio aggregator: Rename property enum to match class name
Add "CONVERT" into the property enum as we're going to add an
enum specifically for the base pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 22:34:49 +00:00
Stéphane Cerveau
63de6d564e videodecoder: add API to receive subframes
A video decoder can now receive subframes and start decoding
instead of waiting for the full frame to be complete.
Subframe support will reduce latency as described in the
video encoder base class.

A unit test illustrating this API is available in
tests/check/libs/videodecoder.c.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/454>
2021-07-08 13:19:21 +02:00
Seungha Yang
aa34710bb6 gl/context/wgl: Add missing NULL init
The value of uninitialized local variable is varying depending
on compiler and not guaranteed to be NULL initialized.
That results in pointing random address instead of expected function pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1222>
2021-07-03 11:40:25 +00:00
Francisco Javier Velázquez-García
6389eef70d videotestsrc: Add SMPTE75 RP-219 color bars conformant
Implement 8-bit values of SMPTE RP 2019-1:2014.  The bar widths and
heights are the result of fractions as integers.  The remainders of
widths are distributed in a way that they match the values in Table
C.1 (a) in the specification.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Jan Alexander Steffens (heftig)
7ab7a8ad7c videotestsrc: Add a start parameter to _blend_line
Makes it easier to paint part of a line.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Jan Alexander Steffens (heftig)
96decaf7ef videotestsrc: Keep tmpline unchanged in_convert_tmpline
This will allow us to repeatedly
call it to render subsequent lines.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Michael de Gans
d8a7fc0a0b appsink: fix incorrect return nullability
This commit fixes the annoations for return nullability on several
GstAppSink functions. This was causing bindings to be generated
incorrectly.

Fixes #914

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1203>
2021-06-30 18:46:37 +00:00
Seungha Yang
058f1e92b7 compositor: Add scaling policy to support PAR-aware scaling
Adding "sizing-policy" property for user to be able to specify
scaling policy (aspect-ratio for example).
At the moment, supported mode is only keep-aspect-ratio, but we might
be able to add more policies such as cropping, etc.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/696
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1156>
2021-06-29 23:06:37 +09:00
Seungha Yang
2551b1d976 video: Deprecate gst_video_sink_center_rect()
... and add gst_video_center_rect() method as a replacement.
The method is useful for outside of videosink subclasses as well
but the old naming might be able to mislead people.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1156>
2021-06-29 18:00:43 +09:00
Jakub Adam
556ce36ce4 rtpbasepayload: don't write empty extension header
When some header extensions are present but none decides to write any
data to the currently processed RTP buffer, remove the extension data
section.

Resulting RTP buffer wasn't formatted correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:28:41 +02:00
Jakub Adam
d294d7da36 rtpbuffer: Add gst_rtp_buffer_remove_extension_data()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:28:41 +02:00
Jakub Adam
e2e9e321f6 rtpbasepayload: map RTP buffer READWRITE when setting headers
GstRTPHeaderExtension::write can map the RTP buffer for reading. If that
happens on a buffer that is already mapped WRITE-only by the payloader,
the payloader's mapping gets invalidated (GstRTPBuffer::map will point
to a different instance of GstMemory).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:07:44 +02:00
Olivier Crête
b4caa6cbdd rtphdrext: Make all fields private
The presence of a method and a field with the same name confuses the C#
binding generator. As there are accessor functions for all the fields,
let's just make them private.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1218>
2021-06-28 18:07:56 +03:00