Commit graph

72 commits

Author SHA1 Message Date
Thibault Saunier
7a371e75b7 Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
Seungha Yang
8f2cab6c03 avauddec: Drain decoder on decoding failure
... and call finish_frame() so that baseclass can reset internal
status. Otherwise baseclass will keep holding the status for
decoding failed frame which will result in outputting buffer with
wrong timestamp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/112>
2020-12-29 16:27:30 +00:00
Arun Raghavan
b6acd99239 avauddec: Check planar-ness of frame rather than context
The check seems to be to present to verify that the decoded frame
matches the format we expect. The actual check for the layout of the
frame was being performed against the context instead.

The check fails at least for avdec_aptx_hd, where the AVCodecContext has
the sample format set to AV_SAMPLE_FMT_NONE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/107>
2020-10-27 07:08:12 -04:00
Sebastian Dröge
1d671c7b89 avauddec/audenc/videnc: Don't return GST_FLOW_EOS when draining
Same behaviour as for avviddec now. FFmpeg will return AVERROR_EOF when it's
completely drained but we should not return that here or otherwise
upstream will receive EOS and not forward us more data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/97>
2020-09-30 16:31:16 +03:00
Seungha Yang
7388b14423 avauddec: Ensure finish_subframe() and finish_frame() are paired
audiodecoder baseclass implementation is expecting that
finish_subframe() is followed by finish_frame() in order clear
its internal state related to subframe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
2020-09-15 02:13:34 +09:00
Sebastian Dröge
6ea6f1545b avauddec: Forward flow returns from draining instead of assuming OK
It might be useful for upstream to know that draining/finishing didn't
succeed, and why.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
2020-09-14 14:30:35 +03:00
Edward Hervey
c6e51f404d avauddec: Avoid dropping non-OK flow return
When sucessfully finishing out frames (or finishing configuration), we must make
sure we don't override any failing GstFlowReturn that might have been detected
previously.

Failure to do this would result in not propagating not-linked, flushing,
etc...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
2020-09-14 14:22:24 +03:00
Matej Knopp
d84b922b7f avauddec: fix buffer leak when send packet failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/81>
2020-06-30 18:39:59 +02:00
Doug Nazar
6382be0996 avauddec: Don't warn if drain is successful 2019-08-01 16:27:35 -04:00
Yeongjin Jeong
472f2ef104 avauddec: Ensure drain even if codec has not delay capabilities
There are decoders that need to be drained if they work on multi-threads,
even if AV_CODEC_CAP_DELAY is not set.
2019-04-29 15:40:08 +09:00
Tim-Philipp Müller
ef8a1bdd90 avauddec: fix decoding of APE and Cook audio
.. and other formats where ffmpeg gives us multiple
subframes per input frame.

Since we now support non-interleaved audio, we can't
just concat buffers any more. Also, audio metas won't
be combined when buffers are merged, so when we push
out the combined buffer we'll look at the meta describing
only the first subframe and think it covers the whole
frame leading to stutter/gaps in the output.

We could fix this by copying the output data into a new
buffer when we merge buffers, but that's suboptimal, so
let's add some API to GstAudioDecoder to push out subframes
and use that instead.

https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/49
2019-03-04 11:54:15 +00:00
Mathieu Duponchelle
ff3a8f6627 decoders: fix draining
https://bugzilla.gnome.org/show_bug.cgi?id=796900
2018-07-31 19:13:25 +02:00
George Kiagiadakis
4596249496 avauddec: add support for decoding in non-interleaved layout
This removes the internal interleave loop and always negotiates
the native output layout of the libav decoder. Users can use
audioconvert to interleave if necessary.

Special care has been taken to leave the encoder unaffected by
the changes in avcodecmap, since GstAudioEncoder doesn't support
the non-interleaved layout yet.

https://bugzilla.gnome.org/show_bug.cgi?id=705977
2018-07-23 16:16:10 +03:00
Seungha Yang
db82350245 libav: Fix symbol redefine build error
https://bugzilla.gnome.org/show_bug.cgi?id=796827
2018-07-19 12:21:01 +01:00
Mathieu Duponchelle
dd37a553ac av*dec: Ignore decoding errors
We were ignoring these before the port to 4.0, interpreting them
as GST_FLOW_ERROR / GST_ELEMENT_ERROR causes check failures.

We should start using GST_*_DECODER_ERROR in latter commits,
for now simply restore the previous behaviour.
2018-07-13 17:24:07 +02:00
Mathieu Duponchelle
e1d0d73fc0 auddec: fix luck-based sinkpad access
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:28 +02:00
Mathieu Duponchelle
6243197c82 avauddec: port to new decoding API
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle
1035d6c820 auddec: stop using deprecated getters
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle
d059922f56 avauddec: remove obsolete version check
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle
e4bf6147a0 av_codec_next (deprecated) -> av_codec_iterate
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Nicolas Dufresne
aa724e2f14 Use AV_ namespace for all CODEC_ macro
The remaining use of CODEC_ are codec flags that has been moved into the
new codec private properties or have been deperated. Will be fixed in
later patches.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne
7b3e41e20b Use AV_ namespace for INPUT_BUFFER_PADDING_SIZE
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Sebastian Dröge
32addd9757 avaudenc/dec: Blacklist more PCM decoders/encoders 2017-04-13 15:23:45 +03:00
Garima Gaur
14dc964f0e Fix some caps leaks when creating pad templates
https://bugzilla.gnome.org/show_bug.cgi?id=776700
2017-01-02 12:41:20 +00:00
Sebastian Dröge
f1bca3115e avaudenc/dec: Allow compilation against ffmpeg < 3.2 again 2016-10-26 23:29:40 +03:00
Sebastian Dröge
440482475f avaudenc/dec: Ignore S64BE/LE pseudo-codecs 2016-10-26 23:20:52 +03:00
Sebastian Dröge
3e93ad1bcd libav: Ignore more quasi-codecs 2016-07-22 14:54:21 +03:00
Sebastian Dröge
3fb49b6053 avauddec: Finish frames if they are header buffers only and don't produce any output
Otherwise we will consider them as one frame of raw audio that is still
pending, and shift all timestamps by the amount of time spent with header
buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=765797
2016-04-29 13:06:07 +03:00
Sebastian Dröge
00ebf95e08 avauddec: If decoding a frame failed, skip it
Otherwise the next successfully decoded frame will get its timestamp and we
will slowly let a/v sync drift apart.

https://bugzilla.gnome.org/show_bug.cgi?id=765797
2016-04-29 12:55:19 +03:00
Tim-Philipp Müller
9e00a37d0e Don't use exported but undeclared core debug category symbols
It's not right and won't work on Windows with MSVC.
2016-02-20 12:59:38 +00:00
Tim-Philipp Müller
83ce87e7c8 av: canonicalise av plugin name more consistently in more places
Use g_strdelimit(), make sure to include comma as well, which
isn't included in G_STR_DELIMITERS.

https://bugzilla.gnome.org/show_bug.cgi?id=734451
2016-01-07 17:16:41 +00:00
Thiago Santos
5c56635e97 avauddec: let audiodecoder call the default pad query handler
Avoids repeating the same handling in many decoders
2015-08-15 13:51:35 -03:00
Thiago Santos
2b387ba827 avauddec: use template caps intersection for accept-caps
Avoid doing downstream caps queries when accept-caps should just
do a shallow caps check on the element itself

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 09:14:11 -03:00
Olivier Crete
3b6c656e25 avauddec: Read channels from the channels field
If there is no layout, just read the channel count from the
channels field.

https://bugzilla.gnome.org/show_bug.cgi?id=752186
2015-07-27 14:18:32 -04:00
Olivier Crête
7afaf5c020 avauddec: Access field using accessors
Those fields are documented to only be safe to access using
accessors as their position is not part of the ABI.
2015-07-25 03:06:10 -04:00
Thomas Bluemel
30a4a28793 avauddec: Ensure input buffers have FF_INPUT_BUFFER_PADDING_SIZE padding, which is required by avcodec_decode_audio4 () 2015-06-30 19:19:42 +02:00
Sebastian Dröge
2a445cb5f2 avauddec: Remove custom buffer allocation function
libav always uses planar audio formats nowadays, not much use in
us trying to allocate anything here until we add support for planar
aka non-interleaved audio formats at least in audioconvert.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
4240ff2bfc avauddec: Use undeprecated AVFrame API 2015-06-28 12:41:55 +02:00
Sebastian Dröge
0767bdda5f avauddec: Negotiate based on the AVFrame instead of just the AVCodecContext 2015-06-28 12:41:55 +02:00
Sebastian Dröge
c6cc7b385a avauddev: Unref decoded AVFrame after we're done with it
Otherwise we might leak some memory, like all compressed data when using
avdec_ac3.
2015-06-02 09:09:09 +02:00
Aleix Conchillo Flaqué
24780708be avauddec: drain samples until libav doesn't have more data
We use have_data (that comes from libav), instead of only trying 10
times, to know if there are more samples available. The old code was
machine dependent as different amount of samples could be decoded by
different type of (more powerful) machines, and 10 times was not always
sufficient.

https://bugzilla.gnome.org/show_bug.cgi?id=737144
2014-09-23 19:14:06 +03:00
Thibault Saunier
dc1e69dbea avauddec: Bump the rank of avdec_aac so it is used by default
https://bugzilla.gnome.org/show_bug.cgi?id=676131
2014-08-06 13:26:37 +02:00
Sebastian Dröge
d494f6f983 avauddec: Mark frames as corrupted if libav tells us they are
This is currently only implemented by the h264 codec and no audio codec.

https://bugzilla.gnome.org/show_bug.cgi?id=722290
2014-01-16 13:46:26 +01:00
Vincent Penquerc'h
ca1b5d8576 gst-libav: fix context leaks
A AVCodecContext needs cleaning up before being freed.
Go through all of the allocations/setups to ensure none of them
can leak a context or its contents.
2014-01-15 09:02:33 +00:00
Sebastian Dröge
1e65aac1a4 avauddec: Give MP3 decoder a MARGINAL rank too
There's no reason why this decoder should not be autoplugged
2014-01-10 13:17:02 +01:00
Sebastian Dröge
8fc3da62c1 avauddec: Stop using AVCODEC_MAX_AUDIO_FRAME_SIZE
And properly use the have_data variable. It's a boolean.
2014-01-03 16:26:10 +01:00
Sebastian Dröge
9febec71c0 avauddec: Don't believe we're negotiated if negotiation failed
It can happen that negotiation fails during get_buffer(), but then
we don't retry later and never return NOT_NEGOTIATED upstream...
and instead run into assertions.

https://bugzilla.gnome.org/show_bug.cgi?id=708769
2013-10-02 12:52:01 +02:00
Sebastian Dröge
6571196fb8 libav: avcodec_close() also resets fields like the AVCodec
We need to reload the defaults for the codec after closing it,
otherwise we can't access codec information like the supported
sample rates and can crash.

https://bugzilla.gnome.org/show_bug.cgi?id=707040
2013-08-29 16:53:28 +02:00
Tim-Philipp Müller
068be939cb CODEC_ID_* -> AV_CODEC_ID_* 2013-05-06 23:56:22 +01:00
Tim-Philipp Müller
b7ef1faab7 Revert "avdec_aac: disable for autoplugging until it gets fixed"
This reverts commit c5980dc52a.

It's fixed now.

https://bugzilla.gnome.org/show_bug.cgi?id=690940
2013-01-26 12:52:29 +00:00