Commit graph

210 commits

Author SHA1 Message Date
Sebastian Dröge
9196c3dcca audiodecoder: Don't get and parse the current srcpad caps
We only get here if we don't have any srcpad caps, and we're going
to override the GstAudioInfo a few lines below anyway without ever
using it if for whatever reason we get caps here.
2015-04-08 20:49:39 -07:00
Sebastian Dröge
0c72d0acdf {audio,video}decoder: Forward SEGMENT_DONE events immediately and drain decoders
Otherwise we're going to wait with draining until the next data comes, which
is a bit suboptimal and might take a long time... or maybe never happens.
2015-04-06 19:20:51 -07:00
Vincent Penquerc'h
2954813b86 audio,video: use gst_segment_is_equal instead of memcmp
memcmp will blindly compare the reserved fields, as well as any
padding the compiler may choose to sprinkle in GstSegment.

Fixes valgrind complaints in unit tests, as well as some found via
https://bugzilla.gnome.org/show_bug.cgi?id=738216
2015-04-03 12:09:41 +01:00
Mark Nauwelaerts
eeeb2eab82 audiodecoder: only return EOS upon clipping if applicable
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-03-07 20:10:31 +01:00
Jan Schmidt
b3053925ac audiodecoder: Don't send pending events before decode
Make sure to update the output segment to track the segment
we're decoding in, but don't actually push it downstream until
after buffers are decoded.

https://bugzilla.gnome.org/show_bug.cgi?id=744806
2015-02-24 01:36:44 +11:00
Mark Nauwelaerts
c321b6bd81 Revert "audiodecoder: drain current segment upon new one to ensure correct flow return"
This reverts commit 696b8cdc40.

See https://bugzilla.gnome.org/show_bug.cgi?id=734617
2015-02-22 16:58:33 +01:00
Mark Nauwelaerts
696b8cdc40 audiodecoder: drain current segment upon new one to ensure correct flow return
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-02-22 13:23:44 +01:00
Thiago Santos
7e39a51a50 audio: video: fix a few GI annotations
transfer-full -> transfer full
@Since -> Since
2015-02-19 15:51:42 -03:00
Sebastian Dröge
8547594727 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 17:53:49 +02:00
Jan Schmidt
4f961e6d95 audiodecoder: Where possible, skip decode for GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO
If we have timestamps on input buffers and are in trickmode no-audio
mode, then don't pass anything to the subclass for decode and simply
send gap events downstream

Only for forward playback for now - reverse requires accumulating
GAP events and pushing out in reverse order.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-02-06 04:09:37 +11:00
Jan Schmidt
c35e3e7c7d audiodecoder: Remove pointless else{} around some code 2015-02-06 04:02:48 +11:00
Jan Schmidt
7c0f885ad2 audiodecoder: Fix reverse playback when there's only one gather set.
The decoder can fail to drain on EOS if there was only one gather
set, because it will never have sent the segment event downstream
and set the output segment, and fail to detect that the rate < 0.0

Make sure to send pending events before sending all the gather data
for decode.
2015-02-06 04:02:48 +11:00
Sebastian Dröge
823cb40642 audio{enc,dec}oder: Always directly post latency messages on the bus when the subclass sets the latency
Instead of doing it only in setcaps for the encoder, and never at all for the
decoder.
2015-02-03 12:15:25 +01:00
Sebastian Dröge
f2a762a3a0 audio{enc,dec}oder: Handle max_latency == GST_CLOCK_TIME_NONE
And initialize the latencies with 0 and NONE.
2015-02-03 12:12:18 +01:00
Jan Schmidt
ef42a163e4 audiodecoder: Fix typo in documentation
Fix a couple of harmless warnings in the gtk-doc parsing
2015-01-27 02:12:08 +11:00
Thiago Santos
36a99922e4 audiodecoder: expose getcaps virtual function
Allows subclasses to do custom caps query replies.

Also exposes the standard caps query handler so subclasses can just
extend on top of it instead of reimplementing the caps query proxying.
2014-12-17 19:15:24 -03:00
Thiago Santos
160dce872b audiodecoder: implement caps and accept-caps queries
Allows decoders to proxy downstream restrictions on caps.

Also implements accept-caps query to prevent regressions caused by the
new fields on the return of a caps query that would cause the accept-caps
to fail as it uses subset caps comparisons
2014-12-17 19:15:23 -03:00
Sanjay NM
d226d45d2f audio: Add error handling to gst_audio_decoder_drain()
https://bugzilla.gnome.org/show_bug.cgi?id=740686
2014-12-14 12:05:52 +01:00
Thiago Santos
fce946a1a3 audiodecoder: do not use fixed caps on source pad
decoders can change the caps on their source pads, so they don't
use fixed caps. Having fixed caps can cause renegotiation issues.
2014-12-11 17:35:03 -03:00
Mathieu Duponchelle
b2413d46ed audiodecoder: Push pending events before sending EOS.
Segments are added to the pending events, and pushing a segment
is mandatory before sending EOS.

+ Adds a test.

https://bugzilla.gnome.org/show_bug.cgi?id=740853
2014-12-05 12:04:04 +01:00
Thiago Santos
a0b25a570a audiodecoder: should post DECODE errors and not ENCODE
Fix error code for audio decoder
2014-10-13 22:26:29 -03:00
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
Sebastian Dröge
99d73c94e9 tag: Update for taglist/tag event API changes 2012-07-28 00:35:02 +02:00
Wim Taymans
683a38ad65 update for new variable names 2012-07-27 15:24:43 +02:00
Mark Nauwelaerts
c91615bd82 audio{de,en}coder: delay input caps processing until processing data
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680614
2012-07-26 14:35:30 +02:00
Mark Nauwelaerts
473371f943 audiodecoder: hold caps ref while needed 2012-07-25 11:58:26 +02:00
Mark Nauwelaerts
65ea6dee60 audiodecoder: only arrange to reconfigure if data provided
... otherwise audio format need not be known already.
2012-07-24 14:48:59 +02:00
Mark Nauwelaerts
d63a4024b8 audiodecoder: minor doc fix 2012-07-24 12:30:21 +02:00
Sebastian Dröge
d55d7fdc38 audio: Renegotiate if necessary
And also correct usage of the base class stream lock.
2012-07-23 12:01:12 +02:00
Sebastian Dröge
7b06c34868 audiodecoder: Handle allocation query 2012-07-23 11:42:22 +02:00
Sebastian Dröge
0814d38e98 audiodecoder: Add propose_allocation, decide_allocation vfuncs and functions to allocate buffers with information from the allocation query results 2012-07-23 10:28:05 +02:00
Edward Hervey
55f692eff6 audiodecoder: Don't assert on pad caps not being set
The decoder might have been de-activated in the meantime (resulting
in NULL pad caps).

If the decoder really isn't configured, then it will error out further
down when checking whether the GST_AUDIO_INFO_IS_VALID()

https://bugzilla.gnome.org/show_bug.cgi?id=667562
2012-07-19 10:55:53 +02:00
Edward Hervey
2817bdadc9 libs: Remove "Since" markers and minor doc fixups 2012-07-13 12:11:06 +02:00
Jan Schmidt
d9740bf9ba audio decoder: Add some debug output for bad caps from children 2012-06-12 23:52:35 +10:00
Vincent Penquerc'h
f8b8711081 audiodecoder: push queued events only when we have a first buffer
https://bugzilla.gnome.org/show_bug.cgi?id=675812
2012-06-11 11:29:13 +01:00
Wim Taymans
a2172bdb4b update for tag event change 2012-06-06 13:05:47 +02:00
Sebastian Dröge
2667d4bb82 Revert "audiodecoder: Error out earlier in a few places if something goes wrong"
This reverts commit eb68a2d5a7.

This sometimes errors out too early now, needs some more thoughts.
2012-06-04 10:01:42 +02:00
Sebastian Dröge
f609b3a627 audiodecoder: Return setcaps return value instead of always TRUE 2012-06-04 09:56:30 +02:00
Sebastian Dröge
eb68a2d5a7 audiodecoder: Error out earlier in a few places if something goes wrong 2012-06-02 17:16:13 +02:00
Alessandro Decina
ebf80977c4 audiodecoder: don't discard timestamps when consecutive input buffers have the same ts
Avoid pushing out buffers with the same timestamp only if the out buffers are
decoded from the same input buffer. Instead keep the timestamps when upstream
pushes consecutive buffers with the same ts.
2012-04-05 10:19:46 +02:00
Sebastian Dröge
a103fa85a9 audio{en,de}coder: Track input and output segments separately
They can go out of sync for some time if processing of buffers
on the old segment happens after the segment was received.
2012-03-30 13:21:09 +02:00
Sebastian Dröge
d8cb235fe4 audiodecoder: Rename ::event() to ::sink_event() and add ::src_event() 2012-03-30 12:23:13 +02:00
Sebastian Dröge
40a4f2f8aa audiodecoder: Rename _byte_time() to _estimate_rate()
Which is telling more about what this actually does and is more
consistent with the video base classes.
2012-03-30 11:51:47 +02:00
Mark Nauwelaerts
2ddc6bb63d audiodecoder: handle downstream seeking query
... or not, in line with how segment events are treated.
2012-03-28 16:41:01 +02:00
Wim Taymans
32bd12dba9 Merge branch 'master' into 0.11
Conflicts:
	.gitignore
	common
	configure.ac
	ext/vorbis/gstvorbisdeclib.h
	gst-libs/gst/audio/gstaudioencoder.c
	gst-libs/gst/riff/riff-read.c
	gst/playback/gstplaysink.c
	gst/playback/gstplaysinkconvertbin.c
	tests/check/libs/video.c
2012-03-22 11:35:13 +01:00
Sebastian Dröge
7ff608889a audio{en,de}coder: Add optional open/close vfuncs
This can be used to do something in NULL->READY, like checking
if a hardware codec is actually available and to error out early.
2012-03-09 10:56:07 +01:00
Tim-Philipp Müller
29c266ccff Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	common
	docs/libs/gst-plugins-base-libs.types
	ext/pango/gsttextoverlay.c
	ext/vorbis/gstvorbisdec.c
	gst/playback/gstplaysink.c
	gst/playback/gstplaysinkconvertbin.c
	sys/ximage/ximagesink.c
	sys/xvimage/xvimagesink.c
2012-03-08 20:31:34 +00:00
Mark Nauwelaerts
8a3f818dce audiodecoder: add some tag handling convenience help 2012-03-06 16:17:37 +01:00
Mark Nauwelaerts
aae64c40a8 audiodecoder: plug caps leak when setting output format 2012-03-05 13:03:57 +01:00
Mark Nauwelaerts
3b0a2a60da audiodecoder: enhance some debug statement 2012-03-05 11:04:20 +01:00
Wim Taymans
268d52fd33 Merge branch 'master' into 0.11
Conflicts:
	gst-libs/gst/rtsp/gstrtspconnection.c
	win32/common/libgstaudio.def
2012-02-17 23:46:17 +01:00