How to aggregate multiple audio buffers into a single GstBuffer of a specific size in bytes

Sebastian Dröge sebastian at centricular.com
Tue Nov 8 13:00:20 UTC 2016


On Mon, 2016-11-07 at 12:09 -0800, Arjen Veenhuizen wrote:
> I would like to aggregate multiple audio samples into one GstBuffer. 
> 
> The following simple pipeline generates normal and proper GstBuffers of 4096
> bytes each.
> 
> 
> 
> But ideally I would like to have GstBuffers of (for example) size 8000. For
> that I could use the rndbuffersize element and set min=8000 and max=8000.
> 
> 
> 
> Unfortunately that will drop my last couple of bytes (since it did not match
> the constrained size of rndbuffersize), e.g. the log reads:
> 
> 
> Anyone has a clever workaround for this? rndbuffersize is clearly not suited
> for this but I would guess there should be an element that could do the
> trick which I simply do not know of.

Write an audio-aware element around a GstAdapter that does all this,
based on a sample-per-buffer or time-per-buffer property.

It's something that is generally useful to have in many scenarios, and
I have that on my todo list since a long time but never got to it.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161108/9ba9331a/attachment.sig>


More information about the gstreamer-devel mailing list