Commit graph

55 commits

Author SHA1 Message Date
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
Stefan Sauer
b2fef1f9d2 audiomixer: fix build flag order
Have the libraries/inlcudes from plugins-bad first to avoid picking up the installed version.
Fixes the build when the local api changed.
2014-12-21 07:47:25 -05:00
Sebastian Dröge
bf3896b2bd audiomixer: Track discont-time per pad instead of globally
We do discont handling per pad, not per element!
2014-12-19 14:40:33 +01:00
Sebastian Dröge
bc418c7a85 audiomixer: We're only EOS if all our pads are actually EOS
Having a buffer or not on the pad is irrelevant.
2014-12-18 23:33:58 +01:00
Sebastian Dröge
eff64c7ddc audiomixer: The pad's size is always supposed to be the whole buffer size
And the offset the offset into that buffer. Changing the size will
cause all kinds of assumptions to fail and cause crashes.
2014-12-18 22:42:14 +01:00
Sebastian Dröge
06f6d3c65c aggregator: Add function to allow subclasses to set their own latency
For audiomixer this is one blocksize, for videoaggregator this should
be the duration of one output frame.
2014-12-17 19:51:32 +01:00
Sebastian Dröge
46f713c598 audiomixer: Make sure to not have pads being behind the current offset
We would break sync between the different streams then.
2014-12-17 19:37:22 +01:00
Sebastian Dröge
d508b39952 aggregator: Add a timeout parameter to ::aggregate()
When this is TRUE, we really have to produce output. This happens
in live mixing mode when we have to output something for the current
time, no matter if we have enough input or not.
2014-12-17 18:41:41 +01:00
Sebastian Dröge
cf90f534f1 audiomixer: Implement get_next_time() 2014-12-16 17:37:12 +01:00
Thibault Saunier
d5a171cae9 audiomixer: Do not try to resize a buffer to a negative size on EOS 2014-11-27 19:10:58 +01:00
Vineeth T M
d38e242a72 audiomixer: critical error for blocksize, timeout min/max values
Audiomixer blocksize, cant be 0, hence adjusting the minimum value to 1
timeout value of aggregator is defined with MAX of MAXINT64,
but it cannot cross G_MAXLONG * GST_SECOND - 1
Hence changed the max value of the same

https://bugzilla.gnome.org/show_bug.cgi?id=738845
2014-10-21 10:58:48 +02:00
Matthew Waters
57c8272c75 aggregator: add latency query handling 2014-10-09 23:52:11 +11:00
Thibault Saunier
22da31f42a audiomixer: Handle seek event in READY state 2014-10-06 18:57:28 +02:00
Thibault Saunier
c158e019c1 audiomixer: Set the sinkpad segments basetime after seeking
Otherwise stream offset and running time comparison will not be
correct, leading to segfaults after seeks
2014-10-06 18:57:28 +02:00
Thibault Saunier
183f4b3227 audiomixer: Port to GstAggregator
https://bugzilla.gnome.org/show_bug.cgi?id=737183

Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
2014-10-06 18:57:28 +02:00
Sebastian Dröge
2ddbaaf866 Release 1.3.1 2014-05-03 19:57:57 +02:00
Stefan Sauer
ec17e33f64 audiomixer: set a group-id on the stream-start event
Set a default group-id to fix a warning printed by the sink.
2014-03-11 22:36:44 +01:00
Sebastian Dröge
ee15c8fd1f audiomixer: Remove some useless assignments and skip the current part of the buffer if the pad is muted 2014-01-16 12:19:57 +01:00