Not getting exact size of buffer from appsink after audioresample
I am using below vesion of pipeline in my C/C++ code,
appsrc ! audioconvert ! audioresample ! "audio/x-raw, rate=48000, format=F32LE" ! appsink
Basically there are two threads,
First thread is push buffer using gst_app_src_push_buffer
by capture buffer from ALSA blocking API pcm_readi at every 4ms interval.
Second thread is pull buffer using gst_app_sink_pull_sample
blocking call.
When ALSA capture device input is changed from 48KHz to 44.1KHz or 96KHz I have putted my pipline into NULL and then update appsrc caps property and then PLAY again.
My code is working fine when input is 48KHz S16LE i.e. 768bytes input and 48KHz F32LE i.e. 1536 bytes output. But having issue with 44.1KHz and 96KHz. For example in case of 96KHz I am getting 1280 bytes of buffer and then 7 times 1536 8th location again 1280 so on ...
Pull Buffer size -> 1280 <--- wrong
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1280 <--- wrong
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1280 <--- wrong
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1280 <--- wrong
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1536
Pull Buffer size -> 1280 <--- wrong
As per theory, input push buffer len is 1536 bytes having 96KHz rate and after resample 1536 bytes having 48KHz output but why this 1280 size of buffer is coming. This is push model of appsrc I'm using without utilsing need-data enough-data signals. Am I missing any property setting with appsrc.