Commit graph

139 commits

Author SHA1 Message Date
Sebastian Dröge
3592bd577c audiodecoder: Simplify code a bit 2014-09-18 12:40:26 +03:00
Ognyan Tonchev
c674a0aa64 audiodecoder: Don't leak events
https://bugzilla.gnome.org/show_bug.cgi?id=736788
2014-09-17 14:11:34 +03:00
Sebastian Dröge
d357f28260 audiodecoder: Fix broken boolean expression
We can seek with end_type==NONE and end_type==SET && end_position=-1. The
check for end_type!=NONE made the second condition impossible.

CID 1226439
2014-08-28 17:00:26 +03:00
Sebastian Dröge
4a69d6ba3b audiodecoder: Don't ignore ::start/stop return values 2014-08-25 13:15:07 +03:00
Jan Schmidt
02d1ab0d1c audiodecoder: Don't drain and flush on SEGMENT events.
As was done for the base video decoder in commit 695675, don't
flush out the decoder on a new SEGMENT event. Segment events
may be a new segment, but are also often segment updates for
the current segment where the old data should be kept. For new
segments, a STREAM_START event will already trigger a drain, but
make sure to flush any remaining partial data then as well.

https://bugzilla.gnome.org/show_bug.cgi?id=734666
2014-08-12 23:54:41 +10:00
Sebastian Dröge
368d75fe75 audiodecoder: Handle CAPS events immediately instead of delaying them
https://bugzilla.gnome.org/show_bug.cgi?id=733147
2014-07-21 09:36:00 +02:00
Sebastian Dröge
909dd7831b audiodecoder: Don't be too picky about the output frame counter
With most decoder libraries, and especially when accessing codecs via
OpenMAX or similar APIs, we don't have the ability to properly related
the output buffers to a number of input samples. And could e.g. get
a fractional number of input buffers decoded at a time.

Previously this would in the end lead to an error message and stopped
playback. Change it to a warning message instead and try to handle it
gracefully. In theory the subclass can now get timestamp tracking
wrong if it completely misuses the API, but if on average it behaves
correct (and gst-omx and others do) it will continue to work properly.

Also add a test for the new behaviour.

We don't change it in the encoder yet as that requires more internal logic
changes AFAIU and I'm not aware of a case where this was a problem so far.
2014-06-20 11:02:55 +02:00
Thibault Saunier
12df7fa49d audiodecoder: Keep still meaningfull pending events on FLUSH_STOP
Only EOS and segment should be deleted in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=709868
2014-06-03 13:03:21 +02:00
Thiago Santos
09b8f902ea audiodecoder: return EOS when segment is over
if a buffer is clipped by being completely out of segment, check if this
buffer is after the end of the segment and return EOS upstream

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 19:26:45 -03:00
Haakon Sporsheim
7c97a1c6cf audiodecoder: Make caps writable before fixating
https://bugzilla.gnome.org/show_bug.cgi?id=729114
2014-04-29 09:58:21 +02:00
Edward Hervey
74eb5fa995 audiodecoder: Plug caps leaks
We were returning in various places without unreffing the caps, and
we were also leaking (overwriting) the caps we got from _get_current_caps()

Spotted by Haakon Sporsheim in #gstreamer
2014-04-25 11:30:37 +02:00
Thiago Santos
695ddbd56f audiodecoder: copy rate and channels from input before fixating output caps
For default caps generation when handling gap events that are sent
before any buffer, try to use caps that are closer to what upstream
provided to avoid fixating rate or channels to 1 as default.

So there are the steps:
1) Try to set rate, channels and channel-mask from upstream if provided
2) Fixate the rate and channels to the default rate and channels from
   audio lib
3) Fixate the caps just to be sure everything is fixed
4) If no channel-mask was provided and channels > 2, use a default
   channel-mask (taken from audioconvert code)

https://bugzilla.gnome.org/show_bug.cgi?id=722144
2014-01-15 15:20:39 -03:00
Thiago Santos
95a56dbda7 audiodecoder: avoid parsing caps event if it is not used
Saves some cpu
2014-01-14 09:34:44 -03:00
Thiago Santos
8cf8332b91 audiodecoder: make sure caps is set before forwarding gap event
Before trying to generate a default fixated caps when handling a gap
event, make sure that the same strategy that is used when handling
a buffer has been attempted. Otherwise audiodecoder will ignore
upstream caps settings such as rate and channels and will likely
end with a caps with channels=1 and rate=1.

https://bugzilla.gnome.org/show_bug.cgi?id=722144
2014-01-14 09:34:44 -03:00
Jan Schmidt
c24a1254c9 audiodecoder: Choose a default initial caps before sending GAP
If there are no caps from the audio decoder when handling a GAP
event - as when one is received right at the start on a DVD without
initial audio - then choose any default caps for downstream and
then send the GAP, so the audio sink has a configured format in
which to start the ringbuffer.

Also, make the audio sink reject a GAP without caps with a clearer
error message.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=603921
2013-12-27 04:04:45 +11:00
Julien Isorce
e68317f070 audiodec/enc: clear reconfigure flag if negotiate succeeds
So that it avoids to send an allocation query twice.
One from an early call to gst_audio_encoder_negotiate from a
subclass, then one from gst_audio_encoder_allocate_output_buffer.
Which means that previously gst_audio_encoder_negotiate was not
clearing the GST_PAD_FLAG_NEED_RECONFIGURE even on success.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=719684
2013-12-05 15:19:16 +00:00
Sebastian Dröge
400d4baf92 audiodecoder: Use FALSE instead of 0 2013-12-05 11:37:09 +01:00
Mark Nauwelaerts
6e639b73ff audiodecoder: no fallback to segment start for reverse playback
See https://bugzilla.gnome.org/show_bug.cgi?id=709965
2013-12-04 19:24:25 +01:00
Mark Nauwelaerts
387e5f0c14 audiodecoder: use segment start as fallback ts if no other available
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=709965
2013-12-02 20:36:21 +01:00
Sebastian Dröge
f8477e6b88 audiodecoder: error out if no frames are decoded before eos
Raise an error in case no frames are decoded before EOS and we
have input, meaning that data was received but it was somehow invalid.

Based on the videodecoder change, merged here for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-26 12:29:30 +01:00
Sebastian Dröge
b0788ce054 audiodecoder: Allow using -1 for infinite tolerated errors
Allows using -1 to make audiodecoder never post an error message
after decoding errors.

Based on the videodecoder change, merged here for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-26 12:20:33 +01:00
Sebastian Dröge
420e229829 audioencoder/decoder: Mark pads as requiring reconfiguration again if negotiation fails
Otherwise we might end up in non-optimal configuration, especially
when a flush happened during reconfiguration.
2013-09-12 09:42:36 +02:00
Sebastian Dröge
daf017ced8 audiodecoder: Fix last commit and simplify code a lot 2013-08-23 19:10:48 +02:00
Edward Hervey
f9ebfd57f8 audiodecoder: Fix previous commit
(sorry)
2013-08-23 16:59:30 +02:00
Edward Hervey
cd3fe60c68 audiodecoder: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
2013-08-23 15:22:05 +02:00
Youness Alaoui
ca2a515373 audiodecoder: Clear taglist on reception of a STREAM_START event
https://bugzilla.gnome.org/show_bug.cgi?id=705109
2013-08-12 13:02:59 +02:00
Matej Knopp
197376212c audiodecoder: do not leak input caps
https://bugzilla.gnome.org/show_bug.cgi?id=704926
2013-07-26 15:37:04 +01:00
Mathieu Duponchelle
97e68b36c7 audiodecoder: Don't return not-negotiated if flushing
If the pad is flushing after a failed negotiation, return GST_FLOW_FLUSHING.

https://bugzilla.gnome.org/show_bug.cgi?id=701763
2013-06-25 12:51:55 -04:00
Sebastian Dröge
b8c6413a8e audio: Always provide a buffer in gst_audio_(enc|dec)oder_allocate_output_buffer()
We have no way of tell the caller of the exact error (e.g. if we're flushing),
so will have to wait until the caller uses API that returns a GstFlowReturn,
for example when pushing this buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=700006
2013-05-24 16:54:46 +02:00
Sebastian Dröge
351405d8a0 audio: Make sure to push pre-caps events before the caps event 2013-05-08 15:56:34 +02:00
Sebastian Dröge
d1a08af605 audiodecoder: Ignore caps events if the input caps did not change 2013-04-18 09:58:36 +02:00
Wim Taymans
76d71da1c4 audiodecoder: don't make negative timestamp
Clamp timestamp interpollation to 0 to avoid going negative. This should not
happen, really, but until the interpolation is improved this seems better.
2013-03-31 13:46:30 +02:00
Wim Taymans
03f658dda2 audiodecoder: forward stream-start immediately 2013-03-30 19:14:37 +01:00
Tim-Philipp Müller
71e46b2478 gst_adapter_prev_timestamp -> gst_adapter_prev_pts
https://bugzilla.gnome.org/show_bug.cgi?id=675598
2012-11-14 00:03:15 +00:00
Sebastian Dröge
d209727644 audiodecoder: Reset error count to 0 after successfully decoding a frame 2012-11-09 16:48:54 +01:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Mark Nauwelaerts
45d802b63f audiodecoder: track forced decoding state 2012-10-24 14:46:22 +02:00
Tim-Philipp Müller
277ca04976 audiodecoder: don't leak message strings when error is not fatal
https://bugzilla.gnome.org/show_bug.cgi?id=681192
2012-10-20 11:38:10 +01:00
Josep Torra
d8d9f0db97 audiodecoder: set of base_ts for segment formats other than time
Fixes setting of converted segment start as base_ts when estimate rate
is allowed.
2012-10-11 13:17:01 +02:00
Sebastian Dröge
e779002cfd audiodecoder: Don't unref caps twice
Thanks to Josep Torra for noticing.
2012-10-10 15:50:31 +02:00
Mark Nauwelaerts
c629a44162 replace gst_tag_list_free with gst_tag_list_unref 2012-09-14 17:53:21 +02:00
Sebastian Dröge
6e33f2d464 audiodecoder: Don't output an (unreffed) buffer in error cases 2012-09-14 14:54:22 +02:00
Mark Nauwelaerts
a29fab200c audio{de,en}coder: use GstClockTime parameters where appropriate
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683672
2012-09-10 11:20:50 +02:00
Jan Schmidt
5dafecad31 audiodecoder: Handle GAP events in place of segment updates
Use them to trigger generation of an empty output buffer or
to send pending events downstream and trigger pre-roll
2012-08-31 12:42:12 -07:00
Víctor Manuel Jáquez Leal
f7f0c55e5f audiodecoder: getter for allocator
Sometimes the decoder would use the allocator for something else than just
allocating output buffers, for example, querying different parameters.

This patch expose a getter accessor for the negotiated memory allocator.
2012-08-14 15:47:34 +02:00
Sebastian Dröge
e9fbba63b5 audiodecoder: Let global tag events be handled the same way as other events 2012-08-09 16:55:19 +02:00
Sebastian Dröge
2a1f8a4da3 audio: Merge upstream stream tags 2012-08-09 16:24:47 +02:00
Sebastian Dröge
7f0e65bb46 audio: Always keep a complete taglist around
Otherwise updates to the tags will cause non-updated
tags to be lost downstream.
2012-08-09 15:48:03 +02:00
Sebastian Dröge
513d4f7cd1 audiodecoder: Add negotiate vfunc that is used to negotiate with downstream
The default implementation negotiates a buffer pool and allocator
with downstream.
2012-08-09 15:10:05 +02:00
Sebastian Dröge
e1702d62a0 audiodecoder: Decouple setting of output format and downstream negotiation
This makes the audio decoder base class more similar to the video
decoder base class.
2012-08-09 15:02:27 +02:00