It's the default buffer size. The default sample size for the audio
renderer is 0.5 seconds. The default capture source accepts the 0.5 second
buffer size but the WDM stream source does not and modifies the size to
suit itself.
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Thanks Chris,
Is there anything I can do to rectify this? My goal is to have 20ms
worth of samples delivered from the capture source.
Thanks again,
/Loren
> Is there anything I can do to rectify this? My goal is to have 20ms
> worth of samples delivered from the capture source.
You should be able to use IAMBufferNegotiation at the output pin of the
capture source before connecting it to the renderer.
For some filters you have to use an intermediate filter to force the buffer
during the connection process but you shouldn't have to here.
--
Ya I see and you are right! However my "real" configuration is this,
and I would really appreciate if you could give me some guidance of
what I'm doing wrong because I'm still getting a delay in my
configuration.
Graph1: Capture (20ms samples 16KHz, 16 bits) to SampleGrabber, then
sample grabber to Null renderer. Null renderer is optional
Graph2: I created a custom CSource/CSourceStream "push" filter to push
media samples to default DirectSound renderer filter(speakers).
CSourceStream::DecideBufferSize() sets up the same params as I use in
the source's IAMBufferNegotiation
I "grab" 20 ms samples from SampleGrabber, and push the sample(s) onto
a queue.
Then, the CSourceStream::FillBuffer() (which is obviously looping),
then takes those samples and fills the IMediaSample passed to it.
I'm obviously doing something wrong here, and if you could point me in
the right direction, I'd appreciate it.
> Ya I see and you are right! However my "real" configuration is this,
> and I would really appreciate if you could give me some guidance of
> what I'm doing wrong because I'm still getting a delay in my
> configuration.
> Graph1: Capture (20ms samples 16KHz, 16 bits) to SampleGrabber, then
> sample grabber to Null renderer. Null renderer is optional
> Graph2: I created a custom CSource/CSourceStream "push" filter to push
> media samples to default DirectSound renderer filter(speakers).
> CSourceStream::DecideBufferSize() sets up the same params as I use in
> the source's IAMBufferNegotiation
> I "grab" 20 ms samples from SampleGrabber, and push the sample(s) onto
> a queue.
> Then, the CSourceStream::FillBuffer() (which is obviously looping),
> then takes those samples and fills the IMediaSample passed to it.
> I'm obviously doing something wrong here, and if you could point me in
> the right direction, I'd appreciate it.
Part 2 of the problem is that the DirectSound renderer has an internal 1
second buffer. Unless it sees that you are a live source it is going to
attempt to keep it's buffers full. By exposing the IAMPushSource on your
output pin the renderer will assume that you are a live source and will
reduce it's buffering to minimal.
--
Grrrrrr.
I implemented the IAMPushSource on my output pin (CSourceStream) and I
notice that the only
method that get's called is GetPushSourceFlags, and I've attempted to
set that flag (returned) to a different value all with the same
results... an audio delay
> I implemented the IAMPushSource on my output pin (CSourceStream) and I
> notice that the only
> method that get's called is GetPushSourceFlags, and I've attempted to
> set that flag (returned) to a different value all with the same
> results... an audio delay
Your flags value should be 0.
When running the graph bring up the audio renderer property page. Make
sure on the Advanced tab that it is showing the slaving mode as Live Graph
Clock.
--