Commit graph

72 commits

Author SHA1 Message Date
Jan Schmidt
e88ecc367b Don't throw compiler warnings with G_DISABLE_ASSERT
Disable code that warns about unused variables when G_DISABLE_ASSERT
is defined, as it is in tarballs and pre-releases.
2015-09-18 00:29:51 +10:00
Sebastian Dröge
41fae5fa5d audioaggregator: Fix mixup of running times and segment positions
We have to queue buffers based on their running time, not based on
the segment position.

Also return running time from GstAggregator::get_next_time() instead of
a segment position, as required by the API.

Also only update the segment position after we pushed a buffer, otherwise
we're going to push down a segment event with the next position already.

https://bugzilla.gnome.org/show_bug.cgi?id=753196
2015-09-14 19:57:00 +02:00
Sebastian Dröge
c91e32bbf7 audioaggregator: Use stream time in the position query instead of segment position
https://bugzilla.gnome.org/show_bug.cgi?id=753196
2015-09-14 19:56:51 +02:00
Olivier Crête
c2794d1ad0 audiointerleave: Avoid caps processing if not yet negotiated
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-07-30 14:00:05 -04:00
Olivier Crête
f6507af946 audioaggregator: On timeout, resync pads with not enough data
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-07-30 14:00:05 -04:00
Olivier Crête
08df711c0c aggregator: Queue "latency" buffers at each sink pad.
In the case where you have a source giving the GstAggregator smaller
buffers than it uses, when it reaches a timeout, it will consume the
first buffer, then try to read another buffer for the pad. If the
previous element is not fast enough, it may get the next buffer even
though it may be queued just before. To prevent that race, the easiest
solution is to move the queue inside the GstAggregatorPad itself. It
also means that there is no need for strange code cause by increasing
the min latency without increasing the max latency proportionally.

This also means queuing the synchronized events and possibly acting
on them on the src task.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-07-30 14:00:05 -04:00
Olivier Crête
9ab4b2e94e audioaggregator: Register function name
Otherwise, it sometimes segfaults with debugging enabled
2015-07-22 19:30:19 -04:00
Olivier Crête
ee1a50ef70 audioaggregator: Use 1.0 style buffer allocation 2015-07-22 19:30:12 -04:00
Nirbheek Chauhan
74d7944cbb audioaggregator: Sync pad values before aggregating
We need to sync the pad values before taking the aggregator and pad locks
otherwise the element will just deadlock if there's any property changes
scheduled using GstController since that involves taking the aggregator and pad
locks.

Also add a test for this.

https://bugzilla.gnome.org/show_bug.cgi?id=749574
2015-07-22 19:50:38 +01:00
Olivier Crête
a1cdede940 audioaggregator: Read output buffer duration with lock held 2015-07-21 21:55:25 -04:00
Tim-Philipp Müller
f64ebd1d21 audiomixer: fix misleading documentation copied from adder 2015-06-09 14:37:36 +01:00
Sebastian Dröge
baff8aa729 Release 1.5.1 2015-06-07 10:55:35 +02:00
Olivier Crête
0fbf2da1bb audiointerleave: Always have "channels" be the actual pad count
Don't force it anywhere

https://bugzilla.gnome.org/show_bug.cgi?id=750252
2015-06-01 19:43:20 -04:00
Olivier Crête
47d7b546c9 audiointerleave: Use the channel count from the set caps
This is the same number that was used to allocate the buffer
2015-06-01 19:42:49 -04:00
Stefan Sauer
af5c05caf1 Revert "doc: Workaround gtkdoc issue"
This reverts commit ff6c736fe0.

This is fixed by the gtk-doc 1.23 release.

<para> cannot contain <refsect2>:
http://www.docbook.org/tdg/en/html/para.html
http://www.docbook.org/tdg/en/html/refsect2.html
2015-05-18 20:16:32 +02:00
Nicolas Dufresne
891c7c6149 doc: Workaround gtkdoc issue
With gtkdoc 1.22, the XML generator fails when a itemizedlist is
followed by a refsect2. Workaround the issue by wrapping the
refsect2 into para.
2015-05-16 23:38:14 -04:00
Olivier Crête
5d78c5cca6 audiomixer: Allow downstream caps with a non-default channel-mask
Instead of failing, take the downstream channel mask if the channel
count is 1.
2015-04-01 20:32:41 -04:00
Luis de Bethencourt
1011a50766 audioaggregator: check sink caps are valid 2015-03-24 16:18:22 +00:00
Luis de Bethencourt
8199405dd7 Revert "audioaggregator: check sink caps are valid"
This reverts commit 6d4d0d1cdf.

Never put code with side effects into an assertion, it can be compiled out
2015-03-24 16:17:00 +00:00
Luis de Bethencourt
a7cfb6240f audioaggregator: check sink caps are valid
CID #1291622
2015-03-24 15:53:17 +00:00
Olivier Crête
edde3c326e audiointerleave: Set src caps in aggregate
This prevents races between the setcaps of the sink pads

https://bugzilla.gnome.org/show_bug.cgi?id=740236
2015-03-16 16:44:03 -04:00
Olivier Crête
fb8339de40 audiointerleave: Add interleave element based on audioaggregator
https://bugzilla.gnome.org/show_bug.cgi?id=740236
2015-03-16 16:44:03 -04:00
Olivier Crête
15369ba016 audioaggregator: Print a message when a buffer is late
https://bugzilla.gnome.org/show_bug.cgi?id=740236
2015-03-16 16:44:03 -04:00
Olivier Crête
acf7745188 audioaggregator: Don't re-send the caps if they did not change
https://bugzilla.gnome.org/show_bug.cgi?id=740236
2015-03-16 16:41:45 -04:00
Olivier Crête
1eef58c3ce audioaggregator: Split base class from audiomixer
Also:
-  Don't modify size on early buffer
   The size is the size of the buffer, not of remaining part.
- Use the input caps when manipulating the input buffer
   Also store in in the sink pad
- Reply to the position query in bytes too
- Put GAP flag on output if all inputs are GAP data
- Only try to clip buffer if the incoming segment is in time or samples
- Use incoming segment with incoming timestamp
   Handle non-time segments and NONE timestamps
- Don't reset the position when pushing out new caps
- Make a number of member variables private
- Correctly handle case where no pad has a buffer
  If none of the pads have buffers that can be handled, don't claim to be EOS.
- Ensure proper locking
- Only support time segments

https://bugzilla.gnome.org/show_bug.cgi?id=740236
2015-03-16 16:41:45 -04:00
Olivier Crête
66807c14fd audiomixer: Release pad object lock before dropping buffer
Otherwise, the locking order is violated and deadlocks happen.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-03-16 14:31:50 -04:00
Olivier Crête
3b2bc85ec6 audiomixer: Only ignore pads with no buffers on timeout
When the timeout is reached, only ignore pads with no buffers, iterate
over the other pads until all buffers have been read. This is important
in the cases where the input buffers are smaller than the output buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-03-16 14:31:50 -04:00
Olivier Crête
3f59bc95b8 audiomixer: Only advance by the buffer size when a buffer is late
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-03-16 14:31:50 -04:00
Sebastian Dröge
25d8f76ecd audiomixer: Fix discont detection and buffer alignment code
Actually accumulate the sample counter to check the accumulated error
between actual timestamps and expected ones instead of just resetting
the error back to 0 with every new buffer.

Also don't reset discont_time whenever we don't resync. The whole point of
discont_time is to remember when we first detected a discont until we actually
act on it a bit later if the discont stayed around for discont_wait time.

https://bugzilla.gnome.org/show_bug.cgi?id=746032
2015-03-12 17:14:33 +00:00
Nirbheek Chauhan
4e221b7a65 audiomixer: Add locking to fill_buffer and fix mix_buffer
The audiomixer pad struct fields may be changed from other threads
2015-03-12 09:53:28 +00:00
Nirbheek Chauhan
8227310d22 audiomixer: Mark a discont when we receive a new segment event
This allows us to handle new segment events correctly; either by dropping
buffers or inserting silence; for example if the offset is changed on an srcpad
connected to audiomixer.
2015-03-12 09:52:15 +00:00
Sebastian Dröge
38cf87aaea Revert "audiomixer: Latency is twice the output buffer duration, not only once"
This reverts commit d387cf67df.

The analysis was wrong: The first 20ms of latency are introduced by the source
already and put into the latency query, making it only necessary to cover the
additional 20ms of audiomixer inside audiomixer.
2015-03-04 13:16:03 +01:00
Sebastian Dröge
fc917fb8cf audiomixer: Latency is twice the output buffer duration, not only once
Let's assume a source that outputs outputs 20ms buffers, and audiomixer having
a 20ms output buffer duration. However timestamps don't align perfectly, the
source buffers are offsetted by 5ms.

For our ASCII art picture, each letter is 5ms, each pipe is the start of a
20ms buffer. So what happens is the following:

0   20  40  60
OOOOOOOOOOOOOOOO
|   |   |   |

  5   25  45  65
  IIIIIIIIIIIIIIII
  |   |   |   |

This means that the second output buffer (20 to 40ms) only gets its last 5ms
at time 45ms (the timestamp of the next buffer is the time when the buffer
arrives). But if we only have a latency of 20ms, we would wait until 40ms
to generate the output buffer and miss the last 5ms of the input buffer.
2015-03-03 20:06:48 +01:00
Tim-Philipp Müller
5fc7d39090 audiomixer: use new gst_aggregator_pad_drop_buffer() 2015-02-13 16:25:52 +00:00
Tim-Philipp Müller
195e54e06a audiomixer: calculate stream_time used to sync pad values correctly
Use pad (input) segment to calculate the stream time from the
input timestamp, not the aggregator (output) segment.
2015-02-12 11:41:10 +00:00
Sebastian Dröge
3c9ae895b0 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
68515c4439 audiomixer: remove now-unused base_time field in object structure 2015-02-06 10:47:20 +00:00
Sebastian Dröge
6d6c693254 audiomixer: Remove weird and wrong segment handling
There's no reason why audiomixer should override the segment
base of upstream with whatever value it got from a SEEK event,
or even worse... with 0 if there was no SEEK event yet. This
broke synchronization if upstream provided a segment base other
than 0, e.g. when using pad offsets.
Also that this code did things conditional on the element's state
should've been a big warning already that something is just wrong.
If this breaks anything else now, let's fix it properly :)

Also don't do fancy segment position trickery when receiving a
segment event. It's just not correct.
2015-02-05 16:02:54 +01:00
Thibault Saunier
b1eef4f436 aggregator: Make the PAD_LOCK private
Instead of using the GST_OBJECT_LOCK we should have
a dedicated mutex for the pad as it is also associated
with the mutex on the EVENT_MUTEX on which we wait
in the _chain function of the pad.

The GstAggregatorPad.segment is still protected with the
GST_OBJECT_LOCK.

Remove the gst_aggregator_pad_peak_unlocked method as it does not make
sense anymore with a private lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Thibault Saunier
198b16c563 aggregator: Hide GstAggregatorPad buffer and EOS fileds
And add a getter for the EOS.

The user should always use the various getters to access
those fields

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
9afd2b3339 audiomixer: Clear GstAudioInfo the the caps
When clearing the caps, also clear the matching GstAudioInfo

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
33f412d6db audiomixer: Don't reset caps on flush
A flush event doesn't invalidate the previous caps event.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
9071b8487c aggregator: Replace event lock with pad's object lock
Reduce the number of locks simplify code, what is protects
is exposed, but the lock was not.

Also means adding an _unlocked version of gst_aggregator_pad_steal_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Tim-Philipp Müller
d7880f217e audiomixer: update for aggregator start/stop vfunc change 2014-12-30 18:01:34 +00:00
Tim-Philipp Müller
5cf0b8c445 audiomixer: fix output-block-size property description 2014-12-30 15:32:46 +00:00
Nirbheek Chauhan
ecc709be31 audiomixer: Document the pad properties 2014-12-27 11:02:36 +00:00
Sebastian Dröge
cd256acf03 audiomixer: If getting a timeout before having caps, just advance our position
This can happen if this is a live pipeline and no source produced any buffer
and sent no caps until the an output buffer should've been produced according
to the latency.
2014-12-23 12:24:48 +01:00
Sebastian Dröge
eefea80dae audiomixer: Make sure to release the current buffer in reset()
If we didn't output the last one in aggregate because we were shutting down
earlier we might otherwise leak it.
2014-12-23 12:15:50 +01:00
Sebastian Dröge
8465c0915e audiomixer: Change blocksize property to output-buffer-duration in time format
This makes the interface of audiomixer independent of the actual caps.
2014-12-23 11:45:50 +01:00
Sebastian Dröge
20a79bda49 audiomixer: Use the src query implementation of aggregator as the default case 2014-12-22 22:12:02 +01:00