Commit graph

83 commits

Author SHA1 Message Date
Vineeth TM
7c42ba97d7 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
Tim-Philipp Müller
01f23d88f3 audiomixer: register function name for debugging just once
Not every time aggregate is called...
2015-11-24 15:17:30 +00:00
Olivier Crête
f0cbeb4140 audioaggregator: Improve log messages
Make the level of log messages saner and improve some.
2015-11-02 19:40:28 -05:00
Olivier Crête
0e2880ac2e liveadder: Make latency property be a uint in millisecs
This restores roughly the same behaviour as the old liveadder element.
Except that the latency now also includes the output-buffer-duration.

https://bugzilla.gnome.org/show_bug.cgi?id=757050
2015-10-28 18:52:24 -04:00
Tim-Philipp Müller
b204d3b95e liveadder: latency property is an uint64 in audiomixer 2015-10-12 09:42:37 +01:00
Olivier Crête
305e5c7ac3 liveadder: Remove plugin, replace by compat subclass of audiomixer
New subclass with a similar behaviour as the old liveadder, but
a slightly different API as the latency is in nanoseconds, not
milliseconds. Also, the new liveadder has a effective latency that
is latency + output-buffer-duration. In practice, just setting a non-zero
latency with the new audiomixer gives you the right behavior in 99% of the
cases.
2015-10-11 11:04:38 +01:00
Vineeth TM
3b89dd4768 audioaggregator: Fix build error
Build error due to wrong argument type in debug message
aagg->priv->offset and next_offset are of type int64, but uint64
formatter is being used in logs. Changing all those to int64

https://bugzilla.gnome.org/show_bug.cgi?id=756065
2015-10-07 11:20:35 +01:00
Sebastian Dröge
40a908b1d9 audioaggregator: Select the initial offset based on the start segment position
instead of always using 0. Otherwise we might output a lot of silence in the
beginning instead of outputting from the relevant position.

https://bugzilla.gnome.org/show_bug.cgi?id=755623
2015-10-01 17:40:59 +02:00
Tim-Philipp Müller
fccee018f3 audiomixer: fix deadlock when G_DISABLE_ASSERT is not defined
This makes the audiomixer unit test time out in master.
Broke with 587e7c4
2015-09-26 10:21:41 +01:00
Sebastian Dröge
bed2c6820f audioaggregator: Stop using deprecated gst_segment_to_position() 2015-09-26 00:17:55 +02:00
Sebastian Dröge
3c44d3eca4 audioaggregator: Only skip the remaining part of a GAP buffer
We might've queued up a GAP buffer that is only partially inside the current
output buffer (i.e. we received it too late!). In that case we should only
skip the part of the GAP buffer that is inside the current output buffer, not
also the remaining part. Otherwise we forward this pad too far into the future
and break synchronization.
2015-09-18 18:00:05 +02:00
Jan Schmidt
587e7c4a23 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
637106e287 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
97fe89f351 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
10ef6403b6 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
3f2bc1e4b2 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
6efc106a67 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
86fb628d09 audioaggregator: Register function name
Otherwise, it sometimes segfaults with debugging enabled
2015-07-22 19:30:19 -04:00
Olivier Crête
034feb5bb9 audioaggregator: Use 1.0 style buffer allocation 2015-07-22 19:30:12 -04:00
Nirbheek Chauhan
ad8cb458ba 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
f8f9c72cc5 audioaggregator: Read output buffer duration with lock held 2015-07-21 21:55:25 -04:00
Tim-Philipp Müller
654a5f3fc7 audiomixer: fix misleading documentation copied from adder 2015-06-09 14:37:36 +01:00
Sebastian Dröge
0034323f49 Release 1.5.1 2015-06-07 10:55:35 +02:00
Olivier Crête
db5b3b5c41 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
45ef27aa46 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
4116d11327 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
ff6c736fe0 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
34a921c31b 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
78ce8ff74f audioaggregator: check sink caps are valid 2015-03-24 16:18:22 +00:00
Luis de Bethencourt
cfdcb14730 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
6d4d0d1cdf audioaggregator: check sink caps are valid
CID #1291622
2015-03-24 15:53:17 +00:00
Olivier Crête
224f14a299 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
b08b01895f 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
c565877991 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
01520c7e47 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
959f8e4a3e 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
ff9be3ba34 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
2d553d1b25 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
9c49624610 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
472069a699 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
3d9020e564 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
0f72e4ccf7 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
44c913413c 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
d387cf67df 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
84a9493a81 audiomixer: use new gst_aggregator_pad_drop_buffer() 2015-02-13 16:25:52 +00:00
Tim-Philipp Müller
5230b2354f 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
037928dcf6 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
dc2c4840f9 audiomixer: remove now-unused base_time field in object structure 2015-02-06 10:47:20 +00:00
Sebastian Dröge
ce7444411e 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
1a07467d5f 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