Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

1/2 second audio delay in both DirectSound app and GraphEdit/DirectShow app under Vista

298 views
Skip to first unread message

Loren Rogers

unread,
Aug 21, 2008, 12:48:26 PM8/21/08
to
Hey gang,
Simply stated, I can drop a DS Audio Capture filter and render
directly to a DirectSound render device in GraphEdit with a 1/2 second
delay. If in the same GraphEdit, I use the WDM streaming audio source
for my mic and attach to the same DirectSound renderer there is very
little delay. So it appears to me that the DS audio capture filter is
"adding" about 1/2 second delay under Vista. The same seems to be
happening using DirectSound technology. ANy ideas? I'm trying to
write an VoIP application and I'm getting that stupid 1/2 second delay
right out of the chute which is unacceptable.
/Loren

Chris P.

unread,
Aug 21, 2008, 5:27:22 PM8/21/08
to

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]

Loren Rogers

unread,
Aug 21, 2008, 5:37:06 PM8/21/08
to
> --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

Chris P.

unread,
Aug 21, 2008, 5:58:54 PM8/21/08
to
On Thu, 21 Aug 2008 14:37:06 -0700 (PDT), Loren Rogers wrote:

> 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.

--

Loren Rogers

unread,
Aug 21, 2008, 10:17:21 PM8/21/08
to
On Aug 21, 5:58 pm, "Chris P." <m...@chrisnet.net> wrote:
> On Thu, 21 Aug 2008 14:37:06 -0700 (PDT), Loren Rogers wrote:
> > 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.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

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.

Chris P.

unread,
Aug 22, 2008, 12:43:05 PM8/22/08
to
On Thu, 21 Aug 2008 19:17:21 -0700 (PDT), Loren Rogers wrote:

> 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.

--

Loren Rogers

unread,
Aug 22, 2008, 2:02:16 PM8/22/08
to
> --http://www.chrisnet.net/code.htm
> [MS MVP for DirectShow / MediaFoundation]- Hide quoted text -
>
> - Show quoted text -

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

Chris P.

unread,
Aug 22, 2008, 6:18:11 PM8/22/08
to
On Fri, 22 Aug 2008 11:02:16 -0700 (PDT), Loren Rogers wrote:

> 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.

--

0 new messages