I'm making an small real-time audio-video application using Directshow. I use SampleGrabber to grab samples from Audio Capture filter. The SampleGrabber's callback is called every second and each sample's size is 88200 bytes. I printed the WAVEFORMATEX:
WAVE_FORMAT_PCM: true
nChannels: 2
nSamplesPerSec: 44100
nAvgBytesPerSec: 176400
nBlockAlign: 4
wBitsPerSample: 16
cbSize: 0
so I have 2 questions:
Is 'sample' in Directshow's aspect is different from 'sample' in audio recording? Because as I know, there are 44100 samples per second (each costs 16 bits) while directshow's SampleGrabber only grab 1 sample per second (each costs 88200 bytes). Look like lots of sample are aggregated and put into a 'buffer' ?
If lots of audio sample are put into a buffer so the buffer's size should be 176400 bytes per sec. Why it is only 88200 bytes per buffer? Is only 1 channel used?
Directshow "sample" is a term for buffer with data:
Then
... size should be 176400 bytes per sec. Why it is only 88200 bytes per buffer?
No it should not. You're seeing the default behavior of capture filter to produce 500 ms buffers. You can use IAMBufferNegotiation
interface (related questions and search for other) to override this behavior.