Commit graph

85 commits

Author SHA1 Message Date
Vincent Penquerc'h
6bc6b6ebbf opusdec: handle missing buffers with no duration
If buffer duration is missing, it is parsed from the packet data.
This is not foolproof, since Opus can change durations on the
fly.

https://bugzilla.gnome.org/show_bug.cgi?id=767826
2016-06-21 10:48:40 +01:00
Tim-Philipp Müller
108c7d6b3c opus: use default error messages in some more cases 2016-05-23 19:28:39 +01:00
Tim-Philipp Müller
c056b99f94 opusdec: use default error message strings in more cases
Details should go into the debug message. We should probably
make up new codes for encoder/decoder lib init failures too.
2016-05-23 15:36:47 +01:00
Olivier Crête
0bfed26f56 opus: Post error message on GST_FLOW_ERROR
https://bugzilla.gnome.org/show_bug.cgi?id=766265
2016-05-19 12:27:57 -04:00
Olivier Crête
1a700c3ae6 opusdec: Use GST_AUDIO_DECODER_ERROR
This way, the first invalid stream won't break all decoding.

https://bugzilla.gnome.org/show_bug.cgi?id=766265
2016-05-18 15:25:38 -04:00
Thiago Santos
60c765174f opusdec: intersect with the filter before returning on getcaps
So upstream gets a smaller set to decide upon as it is what it requested
with the filter

https://bugzilla.gnome.org/show_bug.cgi?id=765684
2016-05-02 14:29:25 -03:00
Thiago Santos
7a5797d3a6 opusdec: improve getcaps to return all possible rates
The library is capable of converting to different rates.

Includes tests.

https://bugzilla.gnome.org/show_bug.cgi?id=765684
2016-05-02 14:29:25 -03:00
Thiago Santos
823832e293 opusdec: remove artificial restriction on rate negotiation
Remove restrictions when rate is 48000, the underlying lib supports
converting any of the input to any of the output rates.

https://bugzilla.gnome.org/show_bug.cgi?id=765684
2016-05-02 14:29:25 -03:00
Thiago Santos
b1153e0f7d opusdec: refactor getcaps repeated code into a function
Easier to read and maintain
2016-05-02 14:23:54 -03:00
Guillaume Desmottes
8d6e315b01 opusdec: fix caps leaks
The caps returned by gst_pad_get_allowed_caps() was leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=765706
2016-04-28 09:18:53 +01:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Havard Graff
461cdd8c26 opusdec: plug caps leak
https://bugzilla.gnome.org/show_bug.cgi?id=763059
2016-03-03 20:10:09 +00:00
Vincent Penquerc'h
625bd68da7 opus: fix mono<->stereo up/down-mixing
https://bugzilla.gnome.org/show_bug.cgi?id=761588
2016-02-26 16:15:20 +00:00
Vincent Penquerc'h
1ef601e7d3 opus: fix FEC
FEC may only be used when PLC is enabled on the audio decoder,
as it relies on empty buffers to generate audio from the next
buffer. Hooking to the gap events doesn't work as the audio
decoder does not like more buffers output than it sends.

The length of data to generate using FEC from the next packet
is determined by rounding the gap duration to nearest. This
ensures that duration imprecision does not cause quantization
to 2.5 milliseconds less than available. Doing so causes the
Opus API to fail decoding. Such duration imprecision is common
in live cases.

The buffer to consider when determining the length of audio
to be decoded is the previous buffer when using FEC, and the
new buffer otherwise. In the FEC case, this means we determine
the amount of audio from the previous buffer, whether it was
missing or not (and get the data either from this buffer, or
the current one if the previous one was missing).
2016-02-03 16:36:10 +00:00
Vincent Penquerc'h
8e9345ec86 opusdec: fix wrong buffer being checked for missing data
This caused a decoding error if the resulting (wrong) buffer size
was passed to the Opus decoding API.

https://bugzilla.gnome.org/show_bug.cgi?id=758158
2016-02-02 15:22:55 +00:00
Vineeth TM
95bf0ae2ae plugins-bad: Fix example pipelines
rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432
2015-12-15 10:30:49 +00:00
Sebastian Dröge
dd741e6412 opusdec: Update sink pad templates
We always require the channel-mapping-field. If it's 0 we require nothing
else, otherwise we need channels, stream-count and coupled count to be
available.
2015-11-05 12:11:19 +01:00
Sebastian Dröge
4ca84a9b1a opus: Add proper support for multichannel audio
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:41 +02:00
Sebastian Dröge
fc475ce01a opusdec: Handle GstAudioClippingMeta instead of the pre-skip field in the OpusHead
oggdemux is outputting the meta now, and only outputs if it should really
apply to the current buffer. Previously we would skip N samples also if we
started the decoder in the middle of the stream.

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
9c195e37da opusdec: Assume 48kHz if no sample rate is given in the header 2015-11-02 09:36:46 +02:00
Thiago Santos
54a5859960 opusdec: remove check for number of channels
opus decoder can convert from different number of channels, no
need to check, just let it negotiate and create a new decoder if
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=755059
2015-09-15 16:00:43 -03:00
Thiago Santos
eada1366bc audiodecoders: use default pad accept-caps handling
Avoids useless check of downstream caps when handling an
accept-caps query

Elements: dtsdec, faad, gsmdec, mpg123audiodec, opusdec,
          sbcdec, adpcmdec, sirendec
2015-08-15 13:51:16 -03:00
Carlos Rafael Giani
e5409361b8 opusdec: Fix PLC frame size calculations
Previously, PLC frames always had a length of 120ms, which caused audio
quality degradation and synchronization errors. Fix this by calculating an
appropriate length for the PLC frame.

The length must be a multiple of 2.5ms. Calculate a multiple of 2.5ms that
is nearest to the current PLC length. Any leftover PLC length that didn't
make it into this frame is accumulated for the next PLC frame.

https://bugzilla.gnome.org/show_bug.cgi?id=725167
2015-07-20 13:25:43 -04:00
Sebastian Dröge
0ea7a89c14 opusdec: If channel/rate negotiation fails, fall back to stereo and 48kHz 2015-06-04 11:54:24 +02:00
Sebastian Dröge
cecb83e590 opusdec: gst_structure_fixate_field_nearest_int() only works if the structure has this field
Just set the rate/channels directly if the caps don't have this field.
2015-06-04 11:45:05 +02:00
Mersad Jelacic
443cc3baab opus: don't use deprecated gst_buffer_new_and_alloc
Use the helper function available in the base class instead.

https://bugzilla.gnome.org/show_bug.cgi?id=748585
2015-04-28 16:36:02 +01:00
Sebastian Dröge
dd674942ba opusdec: Take channels and sample rate from the caps if we have no stream header 2015-03-23 12:09:25 +01:00
Sebastian Dröge
65662c8997 opusdec: Reset the decoder if the caps change 2015-03-23 12:09:09 +01:00
Sebastian Dröge
ef29b92990 opusdec: Take output sample rate from the stream headers too
This way we let opusdec do the resampling if needed and don't carry
around buffers with a too high sample rate if not required.

While Opus always uses 48kHz internally, this information from the
header specifies which frequencies are safe to drop.
2015-03-23 11:57:09 +01:00
Vincent Penquerc'h
b8565d3ab6 opusdec: fix latency query in FEC case
The max latency parameter is "the maximum time an element
synchronizing to the clock is allowed to wait for receiving all
data for the current running time" (docs/design/part-latency.txt).

https://bugzilla.gnome.org/show_bug.cgi?id=744338
2015-03-04 11:04:29 +00:00
Sebastian Dröge
111c831c08 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 14:16:21 +01:00
Tim-Philipp Müller
ebe01db234 Fix up one-element lists in template caps 2014-09-10 17:24:39 +01:00
Sebastian Dröge
0c301bfee7 opusdec: Require caps to be set before any data processing 2013-12-05 12:04:59 +01:00
Wim Taymans
70ac2717a9 opusdec: clear the state of the decoder
Set the channels and rate back to their default values in _stop because they
are used to renegotiate when needed.

See https://bugzilla.gnome.org/show_bug.cgi?id=692950
2013-02-11 11:12:35 +01:00
Thijs Vermeir
41412f08ec opus: use appropriate printf format for gsize 2012-12-18 16:56:28 +01:00
Tim-Philipp Müller
3e208df632 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Carlos Rafael Giani
a01598c1f1 opusdec: fixed buffer unmapping bug
When the decoder received a NULL buffer, it tried to
unmap a not mapped buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=686829
2012-10-25 01:20:23 +01:00
Tim-Philipp Müller
942680d979 Use gst_element_class_set_static_metadata()
where possible. Avoids some string copies. Also re-indent
some stuff. Also some indent fixes here and there.
2012-10-17 17:46:34 +01:00
Mark Nauwelaerts
42024f70dc replace gst_element_class_set_details_simple with gst_element_class_set_metadata 2012-09-14 17:27:49 +02:00
Peter Korsgaard
331b660e65 opus + jpegformat: unbreak non-debug build
opus + jpegformat plugin builds fail when gstreamer is configured with
--disable-gst-debug as they are checking the GST_DISABLE_DEBUG symbol
instead of GST_DISABLE_GST_DEBUG.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

https://bugzilla.gnome.org/show_bug.cgi?id=683850
2012-09-12 09:13:30 +01:00
Vincent Penquerc'h
ad4da8dd0e opus: set author to myself, and update copyright notices
because as slomo noted, in fact pretty much all the code in there is mine.
2012-06-15 10:39:41 +01:00
Vincent Penquerc'h
3dc1ef35b1 opusdec: read gain from the right place in the header
It's at byte offset 16, not 14.
2012-05-29 17:24:33 +01:00
Vincent Penquerc'h
209e3c5e39 opusdec: do not assert on bad header, error out instead 2012-05-27 23:45:53 +01:00
Vincent Penquerc'h
7d731ac155 opusdec: fix lost packet handling for FEC/PLC
The base audio decoder sends zero size packets, not NULL buffers,
to signal dropped packets.
2012-05-24 22:56:41 +01:00
Mark Nauwelaerts
5bb216046e opusdec: tweak caps negotiation
... so as to avoid leaking caps or manipulating NULL caps.
2012-04-10 17:29:11 +02:00
Wim Taymans
0d84de3fa9 opusdec: fix for caps api change 2012-03-12 17:06:11 +01:00
Mark Nauwelaerts
fa02111b7c opus: port to updated 0.11 2012-03-07 17:18:48 +01:00
Edward Hervey
d5b34263cd Merge remote-tracking branch 'origin/master' into 0.11-premerge
Conflicts:
	docs/libs/Makefile.am
	ext/kate/gstkatetiger.c
	ext/opus/gstopusdec.c
	ext/xvid/gstxvidenc.c
	gst-libs/gst/basecamerabinsrc/Makefile.am
	gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c
	gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h
	gst-libs/gst/video/gstbasevideocodec.c
	gst-libs/gst/video/gstbasevideocodec.h
	gst-libs/gst/video/gstbasevideodecoder.c
	gst-libs/gst/video/gstbasevideoencoder.c
	gst/asfmux/gstasfmux.c
	gst/audiovisualizers/gstwavescope.c
	gst/camerabin2/gstcamerabin2.c
	gst/debugutils/gstcompare.c
	gst/frei0r/gstfrei0rmixer.c
	gst/mpegpsmux/mpegpsmux.c
	gst/mpegtsmux/mpegtsmux.c
	gst/mxf/mxfmux.c
	gst/videomeasure/gstvideomeasure_ssim.c
	gst/videoparsers/gsth264parse.c
	gst/videoparsers/gstmpeg4videoparse.c
2011-12-30 11:41:17 +01:00
Vincent Penquerc'h
f807905786 opus: properly create channel mapping tables
There are two of them, unintuitively enough; the one passed
to the encoder should not be the one that gets written to the
file. The former maps the input to an ordering which puts
paired channels first, while the latter moves the channels
to Vorbis order. So add code to calculate both, and we now
have properly paired channels where appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=665078
2011-12-09 15:04:20 +00:00
Olivier Crête
16bb45d64a opusdec: header cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=665078
2011-12-07 14:03:02 +00:00