Theory behind audio source block sizes

Casey Waldren caseywaldren at gmail.com
Tue Feb 19 14:24:52 UTC 2019


Enlightening. In that case, would audiobuffersplit be regarded as more of a
debugging tool / hack to test if pipeline works?

On Tue, Feb 19, 2019, 12:56 AM Sebastian Dröge <sebastian at centricular.com>
wrote:

> On Tue, 2019-02-19 at 00:36 -0800, Casey Waldren wrote:
> > Given an audio source that produces audio in N byte chunks, and a
> > downstream element that consumes chunks of N*4 bytes, what is the
> > best way to link these elements?
> >
> > I have encountered this problem with a plugin that transforms audio
> > from 4 to 2 channels. Gstreamer seems to lack docs on the topic of
> > block sizes, so I feel like I have missed some important knowledge
> > about how audio sources are supposed to operate.
> >
> > I could change the audio source to produce these fixed sized blocks,
> > or the downstream element to accept smaller blocks and accumulate
> > them, e.g. with a GstAdapter. This seems brittle and sounds like a
> > general purpose plugin should be provided for this purpose. Is that
> > audiobuffersplit, or is there some other technique?
>
> The correct solution here is to use e.g. a GstAdapter in the downstream
> element to be able to accept any block size. audio/x-raw caps require
> nothing from the block size of buffers (other than being the same
> amount of samples for each channel), and the size of buffers can also
> change between buffer and buffer.
> Generally, it's a bug in an element if it can't handle raw audio
> buffers of arbitrary size.
>
>
> An alternative would be to define a different caps for this that would
> allow negotiating a specific block size and elements using those caps
> would then ensure to only produce/consume buffers of that size.
>
> --
> Sebastian Dröge, Centricular Ltd · https://www.centricular.com
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190219/a0c12fd9/attachment.html>


More information about the gstreamer-devel mailing list