platform/upstream/gstreamer.git
9 years agoaudiomixer: Add locking to fill_buffer and fix mix_buffer
Nirbheek Chauhan [Wed, 11 Mar 2015 20:19:58 +0000 (01:49 +0530)]
audiomixer: Add locking to fill_buffer and fix mix_buffer

The audiomixer pad struct fields may be changed from other threads

9 years agoaudiomixer: Mark a discont when we receive a new segment event
Nirbheek Chauhan [Wed, 11 Mar 2015 20:26:44 +0000 (01:56 +0530)]
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.

9 years agoRevert "audiomixer: Latency is twice the output buffer duration, not only once"
Sebastian Dröge [Wed, 4 Mar 2015 12:16:03 +0000 (13:16 +0100)]
Revert "audiomixer: Latency is twice the output buffer duration, not only once"

This reverts commit d387cf67df91b59540f32ee17b4c02f747969add.

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.

9 years agoaudiomixer: Latency is twice the output buffer duration, not only once
Sebastian Dröge [Tue, 3 Mar 2015 19:03:55 +0000 (20:03 +0100)]
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.

9 years agoaudiomixer: use new gst_aggregator_pad_drop_buffer()
Tim-Philipp Müller [Fri, 13 Feb 2015 16:06:34 +0000 (16:06 +0000)]
audiomixer: use new gst_aggregator_pad_drop_buffer()

9 years agotests: remove GST_DISABLE_PARSE guards from two tests that don't require it
Tim-Philipp Müller [Thu, 12 Feb 2015 15:48:07 +0000 (15:48 +0000)]
tests: remove GST_DISABLE_PARSE guards from two tests that don't require it

9 years agoaudiomixer: calculate stream_time used to sync pad values correctly
Tim-Philipp Müller [Thu, 12 Feb 2015 11:26:44 +0000 (11:26 +0000)]
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.

9 years agoImprove and fix LATENCY query handling
Sebastian Dröge [Wed, 11 Feb 2015 13:16:21 +0000 (14:16 +0100)]
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

9 years agoaudiomixer: remove now-unused base_time field in object structure
Tim-Philipp Müller [Thu, 5 Feb 2015 15:57:59 +0000 (15:57 +0000)]
audiomixer: remove now-unused base_time field in object structure

9 years agotests: audiomixer: add unit test for proper segment.base handling
Tim-Philipp Müller [Thu, 5 Feb 2015 15:23:04 +0000 (15:23 +0000)]
tests: audiomixer: add unit test for proper segment.base handling

As adjusted by gst_pad_set_offset(), or when doing segment seeks
or looping for example. See previous audiomixer commit.

9 years agoaudiomixer: Remove weird and wrong segment handling
Sebastian Dröge [Thu, 5 Feb 2015 15:02:54 +0000 (16:02 +0100)]
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.

9 years agoaggregator: Make the PAD_LOCK private
Thibault Saunier [Mon, 26 Jan 2015 10:29:08 +0000 (11:29 +0100)]
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

9 years agoaggregator: Hide GstAggregatorPad buffer and EOS fileds
Thibault Saunier [Mon, 26 Jan 2015 10:25:54 +0000 (11:25 +0100)]
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

9 years agoaudiomixer: Make flush start/stop test non-racy
Olivier Crête [Thu, 22 Jan 2015 00:09:13 +0000 (19:09 -0500)]
audiomixer: Make flush start/stop test non-racy

The flush stop could have happened between the source trying
to push the segment event and the buffer, this would cause a warning.
Prevent that by taking the source's stream lock while flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=742684

9 years agoaudiomixer: Replace racy timeout based tested with drain query
Olivier Crête [Thu, 22 Jan 2015 22:41:24 +0000 (17:41 -0500)]
audiomixer: Replace racy timeout based tested with drain query

Using the drain query, we can be certain that the buffer has done going
through the aggregator by taking the stream locks.

https://bugzilla.gnome.org/show_bug.cgi?id=742684

9 years agoaudiomixer: Avoid race in caps negotiation
Olivier Crête [Thu, 22 Jan 2015 00:32:34 +0000 (19:32 -0500)]
audiomixer: Avoid race in caps negotiation

With the current audiomixer, the input caps need to be the same,
otherwise there is an unavoidable race in the caps negotiation. So
enforce that using capsfilters

https://bugzilla.gnome.org/show_bug.cgi?id=742684

9 years agoaudiomixer: Clear GstAudioInfo the the caps
Olivier Crête [Wed, 21 Jan 2015 23:47:40 +0000 (18:47 -0500)]
audiomixer: Clear GstAudioInfo the the caps

When clearing the caps, also clear the matching GstAudioInfo

https://bugzilla.gnome.org/show_bug.cgi?id=742684

9 years agoaudiomixer: Don't reset caps on flush
Olivier Crête [Wed, 21 Jan 2015 23:39:24 +0000 (18:39 -0500)]
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

9 years agoaggregator: Replace event lock with pad's object lock
Olivier Crête [Wed, 14 Jan 2015 19:35:15 +0000 (14:35 -0500)]
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

9 years agoaudiomixer: update for aggregator start/stop vfunc change
Tim-Philipp Müller [Tue, 30 Dec 2014 18:01:34 +0000 (18:01 +0000)]
audiomixer: update for aggregator start/stop vfunc change

9 years agoaudiomixer: fix output-block-size property description
Tim-Philipp Müller [Tue, 30 Dec 2014 15:29:36 +0000 (15:29 +0000)]
audiomixer: fix output-block-size property description

9 years agoaudiomixer: Document the pad properties
Nirbheek Chauhan [Sat, 27 Dec 2014 10:19:39 +0000 (15:49 +0530)]
audiomixer: Document the pad properties

9 years agoaudiomixer: If getting a timeout before having caps, just advance our position
Sebastian Dröge [Tue, 23 Dec 2014 11:24:48 +0000 (12:24 +0100)]
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.

9 years agoaudiomixer: Make sure to release the current buffer in reset()
Sebastian Dröge [Tue, 23 Dec 2014 11:15:50 +0000 (12:15 +0100)]
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.

9 years agoaudiomixer: Change blocksize property to output-buffer-duration in time format
Sebastian Dröge [Tue, 23 Dec 2014 10:45:50 +0000 (11:45 +0100)]
audiomixer: Change blocksize property to output-buffer-duration in time format

This makes the interface of audiomixer independent of the actual caps.

9 years agoaudiomixer: Use the src query implementation of aggregator as the default case
Sebastian Dröge [Mon, 22 Dec 2014 21:11:13 +0000 (22:11 +0100)]
audiomixer: Use the src query implementation of aggregator as the default case

9 years agoaudiomixer: fix build flag order
Stefan Sauer [Sun, 21 Dec 2014 12:47:25 +0000 (07:47 -0500)]
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.

9 years agoaudiomixer: Track discont-time per pad instead of globally
Sebastian Dröge [Fri, 19 Dec 2014 12:04:58 +0000 (13:04 +0100)]
audiomixer: Track discont-time per pad instead of globally

We do discont handling per pad, not per element!

9 years agoaudiomixer: We're only EOS if all our pads are actually EOS
Sebastian Dröge [Thu, 18 Dec 2014 22:33:58 +0000 (23:33 +0100)]
audiomixer: We're only EOS if all our pads are actually EOS

Having a buffer or not on the pad is irrelevant.

9 years agoaudiomixer: The pad's size is always supposed to be the whole buffer size
Sebastian Dröge [Thu, 18 Dec 2014 21:42:14 +0000 (22:42 +0100)]
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.

9 years agoaggregator: Add function to allow subclasses to set their own latency
Sebastian Dröge [Wed, 17 Dec 2014 18:51:32 +0000 (19:51 +0100)]
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.

9 years agoaudiomixer: Make sure to not have pads being behind the current offset
Sebastian Dröge [Wed, 17 Dec 2014 18:37:22 +0000 (19:37 +0100)]
audiomixer: Make sure to not have pads being behind the current offset

We would break sync between the different streams then.

9 years agoaggregator: Add a timeout parameter to ::aggregate()
Sebastian Dröge [Wed, 17 Dec 2014 16:54:09 +0000 (17:54 +0100)]
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.

9 years agoaudiomixer: Add queues after the (live) sources in the unit test
Sebastian Dröge [Wed, 17 Dec 2014 17:20:15 +0000 (18:20 +0100)]
audiomixer: Add queues after the (live) sources in the unit test

9 years agoaudiomixer: Implement get_next_time()
Sebastian Dröge [Tue, 16 Dec 2014 16:37:12 +0000 (17:37 +0100)]
audiomixer: Implement get_next_time()

9 years agoaudiomixer: Do not try to resize a buffer to a negative size on EOS
Thibault Saunier [Thu, 27 Nov 2014 15:43:39 +0000 (16:43 +0100)]
audiomixer: Do not try to resize a buffer to a negative size on EOS

9 years agotests: fix audiomixer test on big endian systems
Tim-Philipp Müller [Sat, 25 Oct 2014 17:50:42 +0000 (18:50 +0100)]
tests: fix audiomixer test on big endian systems

9 years agoaudiomixer: critical error for blocksize, timeout min/max values
Vineeth T M [Mon, 20 Oct 2014 12:55:08 +0000 (18:25 +0530)]
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

9 years agotest: use G_GSIZE_FORMAT in audiomixer test
Aurélien Zanelli [Thu, 9 Oct 2014 12:51:56 +0000 (14:51 +0200)]
test: use G_GSIZE_FORMAT in audiomixer test

https://bugzilla.gnome.org/show_bug.cgi?id=738227

9 years agoaggregator: add latency query handling
Matthew Waters [Mon, 6 Oct 2014 10:46:24 +0000 (21:46 +1100)]
aggregator: add latency query handling

9 years agoaudiomixer: Handle seek event in READY state
Thibault Saunier [Mon, 6 Oct 2014 11:09:00 +0000 (13:09 +0200)]
audiomixer: Handle seek event in READY state

9 years agoaudiomixer: Set the sinkpad segments basetime after seeking
Thibault Saunier [Mon, 21 Jul 2014 09:07:19 +0000 (11:07 +0200)]
audiomixer: Set the sinkpad segments basetime after seeking

Otherwise stream offset and running time comparison will not be
correct, leading to segfaults after seeks

9 years agoaudiomixer: Port to GstAggregator
Thibault Saunier [Wed, 28 May 2014 14:29:37 +0000 (16:29 +0200)]
audiomixer: Port to GstAggregator

https://bugzilla.gnome.org/show_bug.cgi?id=737183

Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>

10 years agoRelease 1.3.1
Sebastian Dröge [Sat, 3 May 2014 16:16:21 +0000 (18:16 +0200)]
Release 1.3.1

10 years agoaudiomixer: set a group-id on the stream-start event
Stefan Sauer [Tue, 11 Mar 2014 21:36:01 +0000 (22:36 +0100)]
audiomixer: set a group-id on the stream-start event

Set a default group-id to fix a warning printed by the sink.

10 years agoaudiomixer: Remove some useless assignments and skip the current part of the buffer...
Sebastian Dröge [Thu, 16 Jan 2014 11:18:45 +0000 (12:18 +0100)]
audiomixer: Remove some useless assignments and skip the current part of the buffer if the pad is muted

10 years agoaudiomixer: Fix and simplify overlap calculation
Sebastian Dröge [Wed, 15 Jan 2014 22:30:28 +0000 (23:30 +0100)]
audiomixer: Fix and simplify overlap calculation

10 years agoaudiomixer: Also resync timestamps on the RESYNC flag
Sebastian Dröge [Thu, 19 Dec 2013 20:59:09 +0000 (21:59 +0100)]
audiomixer: Also resync timestamps on the RESYNC flag

10 years agoaudiomixer: Add unit test for handling unaligned buffers
Sebastian Dröge [Thu, 7 Nov 2013 13:12:17 +0000 (14:12 +0100)]
audiomixer: Add unit test for handling unaligned buffers

That is, buffers that start or end in the middle of an output block.

10 years agoaudiomixer: Fix EOS handling if we have some pending data
Sebastian Dröge [Thu, 7 Nov 2013 13:12:00 +0000 (14:12 +0100)]
audiomixer: Fix EOS handling if we have some pending data

10 years agoaudiomixer: Add test for the discont handling
Sebastian Dröge [Thu, 7 Nov 2013 12:57:35 +0000 (13:57 +0100)]
audiomixer: Add test for the discont handling

10 years agoaudiomixer: Refactor sync test to be more reusable
Sebastian Dröge [Thu, 7 Nov 2013 12:55:32 +0000 (13:55 +0100)]
audiomixer: Refactor sync test to be more reusable

10 years agoaudiomixer: Remove some racy-ness from the unit test
Sebastian Dröge [Thu, 7 Nov 2013 12:48:06 +0000 (13:48 +0100)]
audiomixer: Remove some racy-ness from the unit test

We might already be EOS when we start the mainloop, so only
set the pipeline to PLAYING from the main loop.

10 years agoaudiomixer: Don't take channel mask in consideration in mono or stereo
Sebastian Dröge [Wed, 6 Nov 2013 14:50:08 +0000 (15:50 +0100)]
audiomixer: Don't take channel mask in consideration in mono or stereo

This could cause negotiation to fail.

https://bugzilla.gnome.org/show_bug.cgi?id=708633

10 years agoaudiomixer: Add simply synchronization test
Sebastian Dröge [Wed, 6 Nov 2013 14:18:58 +0000 (15:18 +0100)]
audiomixer: Add simply synchronization test

10 years agoaudiomixer: Add new element based on adder that does synchronized audio mixing
Sebastian Dröge [Wed, 6 Nov 2013 14:18:50 +0000 (15:18 +0100)]
audiomixer: Add new element based on adder that does synchronized audio mixing