Re: DirectShow DirectSound microphone low-latency

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Sep 11, 2:45 pm, "Chris P." <m...@xxxxxxxxxxxx> wrote:
On Tue, 11 Sep 2007 15:32:20 -0000, insidemeth...@xxxxxxxxx wrote:
1) Sometimes the filtergraph gets hung with no rendering, or sometimes
1 video frame. I am waiting for the first key frame packet and it
seems to get hung if this wait is longer (depends on when the viewer
is launched). I'm trying to do this synch on the first Pause so I
establish the base for timestamps and send the first packet to the
decoder. I've tried moving this initialization to the first call to
FillBuffer and doesn't seem to matter.
2) If it starts it usually keeps going with no hanging. The problem is
that the audio has an occasional hiss (a short tch sound). I know that
I'm not dropping any packets and its all on the same LAN (actually the
same machine as the server right now). The audio seems to stay in
perfect sync with the video even after a hiss.
3) When it works, the latency is usually very low, but sometimes not.
However it starts, it stays that way.

The delivery to the audio output pin is on a separate thread with a
priority that is up a notch. But this didn't seem to help much (maybe
less frequent hiss).

Any thoughts on what could cause these symptoms and in general an
approach to keeping everything running smoothly with consistent
timestamps or whatever it takes to keep the audio renderer happy?

2 things.

Hanging. This is most probably a problem with time stamps and number of
available buffers. I would increase the number of video and audio buffers
in the graph to something that adds up to around 100ms (3 video, 10 audio)
and probably not complete the state change to "paused" until after the
network connection has been established and received it's keyframe.

The audio renderer. It uses about a 1000ms DirectSound output buffer with
a built in sync adjuster. The renderer alters the playback speed slightly
based on the rate of incoming data, not enough data (buffer underrun) and
it will slow down, too much data (buffer overrun) and it will speed up. It
doesn't do this perfectly, and the small drop outs you are hearing are
probably buffer underrun's. You can validate this by looking at the
renderer property page if running in GraphEdit. You can probably keep it a
little happier by having more data buffered.

--http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]

I think you are dead on. Trying to be close to real time/low latency,
not using much of that sound output buffer, so I was thinking
underrun. I need to give up a few ms so I can keep it happy. And when
it hangs I think it may be out of buffers on the audio side. I think
video decoder doesn't have a prob, but can try that too if it comes to
it.

I'll report back.

thanks

.



Relevant Pages

  • Re: DirectShow DirectSound microphone low-latency
    ... I am waiting for the first key frame packet and it ... that the audio has an occasional hiss. ... perfect sync with the video even after a hiss. ... It uses about a 1000ms DirectSound output buffer with ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: Encoding multipul live streams in real time
    ... The same issue occures when only recording one video and one audio. ... I would like it more if video frames were dropped rather than messing up the audio. ... If you are clever about buffer allocation, you can get away with one ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Encoding multipul live streams in real time
    ... The same issue occures when only recording one video and one audio. ... I would like it more if video frames were dropped rather than messing up the audio. ... If you are clever about buffer allocation, you can get away with one ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Pull-source SampleGrabber and Push-source stream input
    ... SampleGrabbers to get samples of audio and video from a capture card. ... The goal being to keep a rolling buffer of the last 12 seconds of video ... similar to the Pushsource Filter except it takes a frame at a time from ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Streaming A/V out of sync in a limited netwrok
    ... network packet and there are 2 outpins(audio and video). ... I use buffer in source filter. ... the other side, outpin ...
    (microsoft.public.win32.programmer.directx.video)