Re: WaveIn notification methods

From: Grant Schenck (schenckg_at_optonline.net)
Date: 10/21/04


Date: Thu, 21 Oct 2004 11:03:50 -0400

While we've seen very rare issues where the Cisco wave drivers don't
appear to mark buffers as done, this is a problem that if it is real
has occurred twice in the last several years over a wide variety of
sites with high call (and therefore media) usage. If this problem is
happening with any regularity then I'd look elsewhere for the source
of the problem.

Your best bet may be to add appropriate debug/trace output and capture
a log file so you can see where your getting "stuck." Based on your
description it could be on the wave in or out side on either the Cisco
or sound card side.

I actually use a polling model with the Cisco wave drivers rather then
events. I found it simpler and not a major performance issue.

--
Grant Schenck
Grant Schenck Software
schenckg@optonline.net
http://grantschenck.tripod.com
"lawrence" <las@cybees.com> wrote in message
news:ORhr1sutEHA.2716@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I've made a softphone using cisco tsp, cisco wavedriver, and tapi 2.
The way
> i did it was that the audio data coming from cisco waveIn was passed
to the
> speaker for playback and audio from the mic was passed to cisco
waveout
> device for transmission.Also both the audio were written to a file
for
> recording. I used 150ms latency for the buffers.
>
>  The softphone genarally works fine and conversation can be done,
but once
> in a while conversation become "dead air" or there would be a
one-way audio.
> Grant mentioned something like the wavedrivers don't mark the
waveheader
> flag to done. Is it possible that ciscowavedriver or the wavedriver
of my
> headset (plantronics dsp500) sometimes dont change the flag to
done?? And
> also when i do a waveInreset( ) after a "dead-air" or a oneway, my
program
> hangs up. How can i work around with it?? thanks.
>
>
> p.s. and also where can i find some example code on how to implement
the
> different callback modes?
>
> Regards,
> Lawrence
>
>
>
> "Grant Schenck" <schenckg@optonline.net> wrote in message
> news:ODNRRovsEHA.224@TK2MSFTNGP15.phx.gbl...
> > Chris,
> >
> > As always, thanks for your advice and knowledge.  This is good
stuff
> > and matches my understanding.
> >
> > Earlier I had issues with the wave in events getting stuck
somewhere
> > when I moved other windows on my desktop.  I decided to revisit
this
> > and have a case working with MS on it.  I'm not optimistic in
terms of
> > getting to the bottom of it.
> >
> > I agree on polling vs. other mechanisms.  Specifically in my wait
I
> > tried using a 5 ms timeout and checking the buffers whether the
event
> > popped or I fell out of the wait due to the time out.  That didn't
> > help and based on that I can say the issue is that the event isn't
> > popping because the driver is not marking the buffers done.  Why
the
> > driver stops marking buffers done is beyond me.
> >
> > Thanks, Grant
> >
> > "Chris P. [MVP]" <msdn@chrisnet.net> wrote in message
> > news:#IP7elrsEHA.3972@TK2MSFTNGP15.phx.gbl...
> > > Grant Schenck wrote:
> > >
> > > > "Are you using waveInOpen( )?   If so, have you tried with
> > different
> > > > callback modes, such as CALLBACK_FUNCTION, or
CALLBACK_THREAD?"
> > > >
> > > > I looked at the docs and CALLBACK_THREAD seems to involve a
> > windows
> > > > message.  Searching on goggle the opinions I saw seemed to
> > recommend
> > > > against using it.  What to you folks think?  Is there any
point in
> > > > replacing CALLBACK_EVENT with CALLBACK_THREAD if I'm trying to
> > achieve
> > > > high performance audio?
> > > >
> > > > What about CALLBACK_FUNCTION?  I assume that is better then
> > > > CALLBACK_THREAD but is there any reason to think it would be
> > better
> > > > then CALLBACK_EVENT?
> > >
> > > Many many many many years back I was having the same dilemma as
you
> > trying
> > > to decide what to use.  So many choices!  I wrote a test program
> > that
> > > implemented all the different methods to see what would work
best.
> > Here
> > > were my discoveries:
> > >
> > > CALLBACK_WINDOW - Seemed ok at first, but fell apart when there
were
> > many
> > > window messages flying about.  Perhaps the simplest method to
> > implement.
> > >
> > > CALLBACK_FUNCTION - Essentially useless because you can't do any
> > audio
> > > handing in the callback.  You're choices are to signal an event
or
> > post a
> > > window message, why created this method beats the **** out of
me.
> > >
> > > CALLBACK_THREAD - Didn't work much better than CALLBACK_WINDOW.
> > Makes the
> > > code a little cleaner and allows you to elevate the thread
priority
> > of the
> > > worker thread for a slight performance improvement.
> > >
> > > CALLBACK_EVENT - Worked well on the NT systems.  Requires a
> > dedicated worker
> > > thread to operate at full potential.  The worker thread must be
> > using
> > > WaitOnSingleObject() or WaitOnMultipleObjects(), using any
function
> > call
> > > that generated or processed messages such as
> > MsgWaitForMultipleObjects()
> > > seemed to have a negative impact on performance.
> > >
> > > Now the method you probably didn't think about - CALLBACK_NULL.
Yes
> > you
> > > might be suprised to find out that the lowest latency solution
in
> > many cases
> > > is not to use any callback method at all but rather to poll the
> > buffer
> > > flags.  Polling at a rate of 100 to 200 times a second can get
you
> > latency
> > > in the 20ms range at the expense of a little CPU power.  It
really
> > doesn't
> > > use much if you throw a Sleep(5) into the loop.  Obviously this
> > requires a
> > > dedicated thread and ideally the thread should be set to
> > > THREAD_PRIORITY_TIME_CRITICAL.  Make sure there is absolutely no
> > code in
> > > this high priority thread that can block or you will bring the
> > system to
> > > it's knees.  That means no disk I/O, network etc.
> > >
> > > Which one to use for lowest latency?  CALLBACK_EVENT is
typically
> > the best,
> > > and with special audio drivers can achieve latency down in the
5ms
> > range.
> > > Second best, if CALLBACK_EVENT doesn't work out is polling.
It's
> > not really
> > > worth trying to get the latency too low with WaveIn/Out unless
the
> > > manufacturer of the audio device has supplied special drivers as
> > your going
> > > to be hit by the kmixer 30ms delay anyway.
> > >
> > > -Chris
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: WaveIn notification methods
    ... I've made a softphone using cisco tsp, cisco wavedriver, and tapi 2. ... i did it was that the audio data coming from cisco waveIn was passed to the ... I used 150ms latency for the buffers. ...
    (microsoft.public.win32.programmer.mmedia)
  • tty flip buffer changes in 2.6.16
    ... # drivers that have been updated can be better tuned and bugs whacked out. ... # This replaces the tty flip buffers with kmalloc objects in rings. ... # buffer pool can grow a bit rather than lose characters. ...
    (comp.os.linux.development.system)
  • Re: Juju
    ... embedded into drivers. ... probably what corresponds to USB URBs. ... callers pre-mapping DMA buffers? ... FireWire read transaction to read out the ORB from host memory and then carry ...
    (Linux-Kernel)
  • Windows CE .NET 4.2 x86 with Cisco 350 WLAN... No IP Address
    ... build into the image Cisco WLAN drivers w/LEAP so that the PC104 can LEAP ... On first boot we enter in all the login info into the ACU utility including ...
    (microsoft.public.windowsce.platbuilder)
  • Re: refcounting drivers data structures used in sysfs buffers
    ... the data structures drivers use to provide the data used to refill sysfs ... struct sysfs_buffer must have a struct kref * and probably a destructor ... The old race between disconnect and IO to attribute via sysfs again. ... If I cannot disassociate the drivers from the buffers in the buffers, ...
    (Linux-Kernel)