resampling and reformatting audio when rate/format will not need to change

Tim Müller tim at centricular.com
Fri Mar 16 16:44:50 UTC 2018


On Fri, 2018-03-16 at 09:10 -0700, Charlie Laub wrote:

Hi Charlie,
 
> In some cases I might not know the input audio caps, and they might
> already be the same as the desired output caps. In that case, does
> the resampling code actually run as if it was changing the sample
> rate, or is the element automatically bypassed when it discovers that
> no change is needed? I looked at the code in gstaudioresample.c but I
> did not see anything about it.

Yes, both elements should work in passthrough mode if downstream can
accept the input caps and no work is needed.

> Also, if I need to reformat AND resample, can I construct the
> pipeline like this:
> … ! audioconvert ! audioresample ! audio/x-
> raw,format=NEW_FORMAT,rate=NEW_RATE ! …

Yes, that should work.
 
> Or do I need to explicitly provide caps for both elements
> (audioconvert and audioresample), like this:
> … ! audioconvert ! audio/x-raw,format=NEW_FORMAT  ! audioresample !
> audio/x-raw,rate=NEW_RATE ! …

This should also work, but not be needed.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com


More information about the gstreamer-devel mailing list