Commit graph

1479 commits

Author SHA1 Message Date
Sanchayan Maity
5aa836848e audiodecoder: Move max_errors out of GstAudioDecoderContext
Currently max-errors gets set during init to default or via property.
However, if a decoder element calls gst_audio_decoder_reset with 'full'
argument set to TRUE, it would result in all the fields of context being
zeroed with memset. This effectively results in max-errors getting a
value of 0 overriding the default or user requested value set during
init.

This would result in calls to GST_AUDIO_DECODER_ERROR which track error
counts and allow max-errors, to be ineffective.

To fix this move max-errors out of GstAudioDecoderContext, as changes to
context should not affect this. The error_count is anyways also in
GstAudioDecoderPrivate and not in context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/946>
2020-11-27 14:49:10 +05:30
Marijn Suijten
3ec795f613 audio: Move fill_silence into audio_format_info
With the function named gst_audio_format_fill_silence it would get
associated to the GstAudioFormat type in .gir which is incorrect and
confusing. See [1] for the discussion sparking this change.

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/630#note_694795

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/940>
2020-11-25 19:18:25 +01:00
Xavier Claessens
a28a75652e Meson: Use pkg-config generator 2020-10-23 11:19:11 -04:00
Sebastian Dröge
6af87dee17 audio/videodecoder: Initialize max_errors in instance_init()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/882>
2020-10-20 12:46:07 +03:00
Sebastian Dröge
ed62e78c6e audio/videodecoder: Don't reset max-errors in reset()
Otherwise setting the property on the elements has no effect at all
because it's immediately reset during startup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/881>
2020-10-20 11:52:07 +03:00
Jan Alexander Steffens (heftig)
aa89ae8beb audio: video: Fix in/outbuf confusion of transform_meta
There are three instances where in- and outbuf have been swapped. This
didn't affect the correctness of the libs *filter code, but the
videoscale implementation swapped the arguments of meta->transform_func.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/853>
2020-10-08 18:30:39 +02:00
Sebastian Dröge
1208d4e635 audioaggregator: Reset offset if the output rate is renegotiated
On next aggregation the new offset will be calculated based on the
segment position.

Without this a rate change would cause a jump forwards or backwards in
the output timeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/794>
2020-09-09 09:09:17 +00:00
Sebastian Dröge
391d09dc24 audio/video: Copy more metas by default in the codec base classes
For audio we copy metas that have no tags at all, or that only have the
"audio" and/or "audio-channels" tag. Audio codecs don't change the
audio aspect of the stream and in almost all cases don't change the
number of channels. They might however change the sample rate (e.g.
Opus). Subclasses that change the number of channels will have to
override ::transform_meta() accordingly.

For video we copy metas that have no tags at all, or that only have the
"video" and/or "video-size" and/or "video-orientation" tag. Video codecs
don't change the "video" aspect of the stream and in almost all cases
don't change the resolution or orientation. Subclasses that rescale or
change the orientation will have to override ::transform_meta()
accordingly.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/576#note_610581

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/801>
2020-08-30 22:12:22 +00:00
Sebastian Dröge
6b14080941 audioaggregator: Add support for new sample selection API
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/805

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/780>
2020-08-07 19:23:50 +03:00
Sebastian Dröge
f5a02639e1 audioaggregator: Only check downstream caps when handling CAPS events if we didn't negotiate with downstream yet
If we already negotiated with downstream there is not point in checking
if the caps are supported. We already know that this is the case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/768>
2020-07-28 10:59:25 +03:00
Sebastian Dröge
607dc1d135 audioaggregator: Check all downstream allowed caps structures if they support the upstream rate
Otherwise it might happen that downstream prefers a different rate (i.e.
puts it into the first structure) and also supports other rates, but
audioaggregator would then fail negotiation.

Also this now correctly handles downstream returning a range of
supported rates.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/768>
2020-07-27 18:49:48 +03:00
Silvio Lazzeretti
aa4bea913b audioutilsprivate: restore thread priority before ending
The priority of the thread that executes audioringbuffer_thread_func
is incremented on Windows by the usage of the AvSetMmThreadCharacteristics
API. This change has to be restored, as described on the documentation
of the API (https://docs.microsoft.com/en-us/windows/win32/api/avrt/nf-avrt-avsetmmthreadcharacteristicsw#remarks),
with a call to the AvRevertMmThreadCharacteristics. If this is not done,
a handle will be leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/760>
2020-07-18 13:00:00 +02:00
Seungha Yang
f0a9907097 audioutilsprivate: Don't try to load avrt for UWP application
All APIs in avrt.h are desktop only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/763>
2020-07-17 18:55:31 +09:00
Sebastian Dröge
f94c7ae3c9 audioaggregator: Fix negotiation with downstream if there is no peer yet
get_allowed_caps() will return NULL, which is not a problem in itself.
Just take the template caps for negotiation in that case instead of
erroring out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/744>
2020-07-09 16:48:02 +00:00
Tim-Philipp Müller
6bb3e01918 meson: add update-orc-dist target
Add target to update backup orc -dist.[ch] files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/734>
2020-07-04 14:01:56 +01:00
Havard Graff
0826fb95b7 audio: video: Optimize by using cached quark for meta tag
Avoid taking the global quark lock for every single buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/295>
2020-06-27 09:23:10 +00:00
Sebastian Dröge
63933da9e8 audiodecoder: Add max-errors property
The number of consecutive decode errors that should be tolerated before
returning flow error should be up to the application, not the element.

Hence max-error should be exposed as a property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/720>
2020-06-23 07:17:00 +00:00
Sebastian Dröge
f2af205a78 Fix up and add various "Since" markers and other related docs fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/713>
2020-06-19 12:17:55 +03:00
Guillaume Desmottes
008d72d5da audio: add missing space in GST_AUDIO_FORMATS_ALL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/694>
2020-06-10 10:43:42 +02:00
Guillaume Desmottes
e2f6b85fd9 audio: sort formats by quality
Will ensure that we pick the "best" format when negotiating caps.

Fix #649

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/689>
2020-06-09 08:09:58 +00:00
Guillaume Desmottes
02fd2f12f9 audio: add gst_audio_make_raw_caps()
More binding friendly version of GST_AUDIO_CAPS_MAKE().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Guillaume Desmottes
58a6303a5f audio-format: remove empty space prefix from GST_AUDIO_FORMATS_ALL
This space prevent deserialization using gst_value_deserialize().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Guillaume Desmottes
75411ce1e7 audio-format: add gst_audio_formats_raw()
The existing GST_AUDIO_FORMATS_ALL macro is not binding friendly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Seungha Yang
4a774e878f audiosink: Keep baseclass extensible
Add a structure for future extension.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/716
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/547>
2020-05-28 19:14:29 +09:00
Jan Schmidt
fd3942d06b audiodecoder: Handle instant-rate-change event
When receiving an instant-rate-change event, store the updated
seek flags and replace the flags in any input segments with them
to allow for instant switching between trickmodes and not.
2020-04-01 21:01:38 +00:00
Jan Schmidt
f9c5db7d56 audiobasesink: Handle an extra case of buffers being out of segment
It's possible that a buffer might be within the segment proper,
but not within the "valid" part we're playing, which is only
things after the 'offset' part of the segment. In that case,
the running-times of the buffer-start and buffer-stop will be
GST_CLOCK_TIME_NONE, and we'd better not schedule playback that
far in the future.
2020-04-01 21:01:38 +00:00
Niels De Graef
21a107294d streamvolume: Use G_DECLARE_INTERFACE 2020-03-20 06:20:43 +00:00
Guillaume Desmottes
545d0b144f audio: annotate @buf in finish_frame methods 2020-03-18 15:38:25 +01:00
Niels De Graef
ec84cf92f9 *aggregator: Add g_autoptr support for *ConvertPad 2020-03-16 15:47:58 +00:00
Jonas Holmberg
af909c6d82 audioencoder: fix segment event leak
Segment event was leaked if format != _TIME.
2019-12-20 12:43:35 +00:00
Jochen Henneberg
33ae846607 audioringbuffer: Reset reorder flag before check
This function might be revisited with different channel position mapping
while audio source goes into play so the reorder flag needs to be reset
before the checks happen.
2019-11-17 14:10:31 +00:00
Sebastian Dröge
89f613abf5 audio-buffer: Don't fail to map buffers with zero samples
Instead initialize the map infos, etc to NULL like gst_buffer_map()
would be doing on a zero-sized buffer.

This fixes a crash in audioresample if the first output buffer would
contain zero samples.
2019-11-14 14:47:44 +01:00
Seungha Yang
2f89c3aff1 audio-info: Allow from_caps() with encoded audio format
Similar to gst_video_info_from_caps() which allows encoded video format,
don't error gst_audio_info_from_caps() with encoded audio format.
Because gst_audio_info_set_format() supports encoded format, current
behavior does not seem to be consistent.
2019-10-25 12:32:03 +09:00
Tim-Philipp Müller
289d8e53e2 Remove autotools build system 2019-10-13 14:15:43 +01:00
Axel Mårtensson
feb1e24347 audiosink: fix resuming after pause
For resuming after paused, gst_audio_sink_ring_buffer_start() needs to
be called to notify the ringbuffer to continue to play.
2019-09-27 05:34:57 +00:00
Philippe Renon
0dc1b6049e audiosink: expose more audioringbuffer vmethods to child sinks
The newly exposed vmethods are pause, resume, stop and clear_all.
The existing reset vmethod is deprecated.

The audio sink will fallback to calling reset if pause or stop
are not provided and will fallback to calling start if
resume is not provided. There is no default clear_all
implementation.
Existing audio sinks continue to work as before.

This change is useful for sinks that need to distinguish
between a pause and a stop (currently both are handled
by a reset) and is needed for https://bugzilla.gnome.org/show_bug.cgi?id=788362

https://bugzilla.gnome.org/show_bug.cgi?id=788361
2019-09-27 05:34:57 +00:00
Nirbheek Chauhan
6f7c9e43bc audio: Use LoadPackagedLibrary when building for UWP
Universal Windows Platform apps are not allowed to use LoadLibrary to
load arbitrary DLLs from the filesystem. They can only use
LoadPackagedLibrary to load DLLs that have been packaged with the app
as assets.

See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/190
2019-09-24 15:17:39 +00:00
Doug Nazar
0c955c16ce audio-resampler: Update NEON to handle remainders not multiples of 4
If the remainder is not evenly divisable by 4, we'd miss the check
for zero and continue the loop until crashing. Change the branch
to take into account negatives as well.

This more closely matches the SSE loop.
2019-09-02 23:25:39 -04:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Mathieu Duponchelle
4ccc7a51d1 {audio,video}aggregator: define autoptr cleanup functions 2019-08-28 14:52:22 +00:00
Hou Qi
b65d1c6de9 audiodecoder: fix ctitical info assertion 'GST_IS_CAPS (dec->priv->ctx.caps)' failed
Matroskademux will send gap event when lag of video and audio is over 3 seconds.
audiodecoder needs to handle gap event and set default output caps.
Only audio info is set, while output caps is ignored. This cause the assertion failed.

Need to fill output caps in gst_audio_decoder_negotiate_default_caps() with
negotiated caps to avoid critical info printed when check it later.
2019-08-28 00:59:56 +00:00
Mathieu Duponchelle
f65145371b audioaggregator: add missing Since tag 2019-08-12 19:11:06 +02:00
Sebastian Dröge
1ec1123178 audioaggregator: Split getcaps() function into two
One for convert pads and one for normal sink pads.
2019-07-18 08:46:42 +03:00
Sebastian Dröge
0a21c28484 audioaggregator: Always take first configure pad's rate and downstream caps into account when calculating allow sink caps
While we can convert between all formats apart from the rate, we
actually need to make sure that we comply with a) the rate of the first
configured pad and b) also all the allowed rates from downstream.
2019-07-18 08:43:14 +03:00
Sebastian Dröge
7080d216a8 audioaggregator: If we don't have a GstAudioAggregatorConvertPad, don't assume that we can actually convert 2019-07-18 08:43:14 +03:00
Mathieu Duponchelle
bced52d2e8 audioaggregator: always use downstream's rate requirements
We were previously only fixating the rate in the getcaps
implementation when downstream was requiring a discrete value,
causing negotiation to fail when upstream was capable of rate
conversion, but not made aware that it had to occur.

Instead of fixating the rate, we can simply update our sink
template caps with whatever GValue the downstream caps are holding
as their rate field.

Allows negotiation to successfully complete with pipelines such as:

audiotestsrc ! audio/x-raw, rate=48000 ! audioresample ! audiomixer name=m ! \
audio/x-raw, rate={800, 1000} ! autoaudiosink \
audiotestsrc ! audio/x-raw, rate=44100 ! audioresample ! m.
2019-07-18 08:43:14 +03:00
Doug Nazar
fb842a3fdb audiodecoder: Fix leak on failed audio gaps
If we fail to process the gap event we need to unref the event or
we end up with a leak.
2019-06-26 03:51:03 -04:00
Niels De Graef
93daa1435a Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means we
no longer need the macro there, but for most types in base/gst-libs we
don't want to break ABI, which means it's better to just keep it like it
is (and use the `#ifdef` instead).
2019-06-04 20:31:09 -04:00
Mathieu Duponchelle
31ac4f4665 gstaudioaggregator: expose output-buffer-duration-fraction
The code for this is mostly lifted from audiobuffersplit, it
allows use cases such as keeping the buffers output by compositor
on one branch and audiomixer on another perfectly aligned, by
requiring the compositor to output a n/d frame rate, and setting
output-buffer-duration to d/n on the audiomixer.

The old output-buffer-duration property now simply maps to its
fractional counterpart, the last set property wins.
2019-05-16 02:55:14 +02:00
Thibault Saunier
287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00