Commit graph

24 commits

Author SHA1 Message Date
Tim-Philipp Müller dec3aa55e9 audioconvert, audioresample, audiofilter: fix divide by 0 for input buffer without caps
gst-launch-1.0 audiotestsrc ! udpsink host=127.0.0.1
gst-launch-1.0 udpsrc ! audioconvert ! autoaudiosink

would crash with a floating point exception when clipping the input
buffer owing to a division by zero because no caps event was received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3469>
2022-11-26 08:47:49 +00:00
Mathieu Duponchelle b5cd758230 aggregator: Implement force_live API
Setting force_live lets aggregator behave as if it had at least one of
its sinks connected to a live source, which should let us get rid of the
fake live test source hack that is probably present in dozens of
applications by now.

+ Expose API for subclasses to set and get force_live
+ Expose force-live properties in GstVideoAggregator and GstAudioAggregator
+ Adds a simple test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3008>
2022-11-18 18:14:26 +00:00
Sebastian Dröge c878d0f68b core/base: Only post latency messages if the latency values have actually changed
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1525

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3282>
2022-10-27 15:25:22 +00:00
Sebastian Dröge e0b06df223 audio: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Philipp Zabel 3b900e1fa4 buffer: drop parent meta in deep copy/foreach_metadata
The purpose of a deep buffer copy is to be able to release the source
buffer and all its dependencies. Attaching the parent buffer meta to
the newly created deep copy needlessly keeps holding a reference to the
parent buffer.

The issue this solves is the fact you need to allocate more
buffers, as you have free buffers being held for no reason. In the good
cases it will use more memory, in the bad case it will stall your
pipeline (since codecs often need a minimum number of buffers to
actually work).

Fixes #283

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2928>
2022-09-28 12:34:44 -06:00
Thibault Saunier bc9c1e3956 meson: Namespace the plugins_doc_dep/libraries variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Xavier Claessens b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Corentin Noël a5249f7c5f gst-plugins-base: Fix several annotations
Add annotations for virtual methods when possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1965>
2022-03-16 10:37:44 +00:00
Sebastian Dröge 3941eb7dbd audioconvert: Add dithering-threshold property
By default, no dithering is applied if the target bit depth is above 20
bits. This new property allows to apply dithering nonetheless in these
cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1730>
2022-02-25 19:32:28 +00:00
Sebastian Dröge e119cdee3b audio-quantize: Switch dither PRNG from LCG to xorshift
While this is slightly more expensive (~48% slower per random number) it
does not cause any measurable difference when running through a complete
audio conversion pipeline.

On the other hand its random numbers are of much higher quality and on
spectrograms for 32 bit to 24 bit conversion the difference is clearly
visible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1729>
2022-02-25 12:41:18 +00:00
Nicolas Dufresne 6bd1f2753a base: audioencoder: Keep serialize event behind buffers
If a serialized event arrives behind a buffer, it should not be send before
it. This fixes the pending event handling so that only early pending events,
the one that arrrived or was generated while the adapter was empty get send
before pushing buffer. All other events are not pushed after.

This issue lead the latency tracer to think our audio encoder did not have any
latency. This was testing with opusenc in a live pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1266>
2022-02-18 14:40:29 -05:00
Mathieu Duponchelle 830d1595b9 VideoInfo, AudioInfo: fix usage with python bindings
* Expose an actual constructor from caps

* Error out in overrides for code that was using the "manual
  allocation" pattern which only worked by chance. Direct
  the script writer to the new_from_caps constructor instead.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-python/-/issues/47

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1571>
2022-01-27 08:36:46 +00:00
Vivia Nikolaidou 88e1b9081e audioaggregator: Return NOT_NEGOTIATED when the configuration is invalid
Otherwise we just end up outputting garbage.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/957

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1558>
2022-01-26 10:24:21 +00:00
Nirbheek Chauhan 945fd11907 audio: Add logging that was useful in figuring out the last commit
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1461>
2022-01-08 05:15:30 +00:00
Nirbheek Chauhan 554a2a5145 audio-converter: Fix resampling when there's nothing to output
Sometimes we can't output anything because we don't have enough
incoming frames. In that case, the resampler was trying to call
do_quantize() and do_resample() in a loop forever because there would
never be samples to output (so chain->samples would always be NULL).

Fix this by not calling chain->make_func() in a loop -- seems
completely unnecessary since calling it over and over won't change
anything if the make_func() can't output samples.

Also add some checks for the input and / or output being NULL when
doing conversion or quantization. This will happen when we have
nothing to output.

We can't bail early, because we need resampler->samples_avail to be
updated in gst_audio_resampler_resample(), so we must call that and
no-op everything along the way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1461>
2022-01-08 05:15:30 +00:00
Nirbheek Chauhan 5d3009b7f8 audio-resampler: Fix segfault when we can't output any frames
Sometimes the resampler has enough space to store all the incoming
samples without outputting anything. When this happens,
gst_audio_resampler_get_out_frames() returns 0.

In that case, the resampler should consume samples and just return.
Otherwise, we get a segfault when gst_audio_resampler_resample() tries
to resample into a NULL 'out' pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1343>
2021-11-12 16:12:27 +00:00
Xavier Claessens eb072600a6 Revert "audio: Merge simd libs into the main one"
This reverts commit 4d3a200358.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1194>
2021-10-19 16:56:35 +00:00
Tim-Philipp Müller cf9be70946 gst-plugins-base: define G_LOG_DOMAIN for all libraries
Fixes #634

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1009>
2021-10-19 00:12:25 +00:00
Mathieu Duponchelle c3d878e990 audio/video aggregator: make use of new aggregator inactive pad API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/867>
2021-10-18 22:34:11 +00:00
Thibault Saunier 6e79932ad9 meson: List libraries and their corresponding gir definition
Introduces a `libraries` variable that contains all libraries in a
list with the following format:

``` meson
libraries = [
    [pkg_name, {
        'lib': library_object
        'gir': [ {full gir definition in a dict } ]
    ],
    ....
]
```

It therefore refactors the way we build the gir so that we can reuse the
same information to build them against 'gstreamer-full' in gst-build
when linking statically

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1093>
2021-10-15 19:27:30 -03:00
Thibault Saunier e2dd28a753 meson: Mark files as files()
Making it more robust and future proof

And fix issues that it creates

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1093>
2021-10-15 19:27:30 -03:00
Olivier Crête 4d3a200358 audio: Merge simd libs into the main one
Actually extract the .o objects from the convience libraries and put
them into the main one. Without this, they will just be referenced by
the .pc file, but it will be unusable because they are not installed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1122>
2021-10-13 01:28:16 +00:00
Tim-Philipp Müller 43ed0df54c audio: make GST_AUDIO_INFO_IS_UNPOSITIONED return a boolean
Luckily this worked right since the flag we check is the
only flag and its vale is 1, but feels more correct to
actually check for non-zeroness.

Spotted by Stirling Westrup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/926>
2021-09-29 23:53:12 +00:00
Thibault Saunier 2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00