[Asterisk-Dev] Re: Audio delay in MeetMe using SIP when not 'q' mode
Tony Mountifield
tony at softins.clara.co.uk
Mon Feb 14 10:58:07 MST 2005
In article <cuqnpq$qj9$1 at softins.clara.co.uk>,
Tony Mountifield <tony at softins.clara.co.uk> wrote:
> In article <4210DE98.9070302 at starnetworks.us>,
> Kevin P. Fleming <kpfleming at starnetworks.us> wrote:
> > Tony Mountifield wrote:
> >
> > > I am suspecting that the problem is something to do with the conf_play()
> > > of the enter and leave sounds. My guess is that by writing that raw data
> > > into the pseudo device fd, it causes a backlog that never drains, because
> > > the device is only getting emptied at the same rate as the conference is
> > > filling it.
> >
> > That's very interesting... it certainly seems possible that it could be
> > the case. It would be pretty simple to test, just replace the "conf
> > enter" sound with something quite a bit longer (4 or 5 seconds) and
> > determine if the delay increases accordingly.
>
> Well I've tried the next best thing: commented out the careful_write that
> is in conf_play(). The delay then went away, even on non-q confs.
I've just had an idea how to fix it.
a) Have conf_play() return the length of the data it wrote.
b) Have a variable 'skiplen', and write the ENTER sound as:
skiplen += conf_play(conf, ENTER);
c) In the main loop, when processing the voice frames, do this:
} else if (using_pseudo) {
if (f->frametype == AST_FRAME_VOICE) {
if (f->subclass == AST_FORMAT_SLINEAR) {
/* Carefully write */
if (skiplen == 0)
careful_write(fd, f->data, f->datalen);
else if (skiplen >= f->datalen)
skiplen -= f->datalen;
else {
careful_write(fd, f->data + skiplen, f->datalen - skiplen);
skiplen = 0;
}
} else
ast_log(LOG_WARNING, "Huh? Got a non-linear (%d) frame in the conference\n", f->subclass);
}
}
This would then throw away the voice bytes that would have occupied the
space now taken by the Enter sound.
I haven't tested it yet. Will do shortly.
Cheers
Tony
--
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org
More information about the asterisk-dev
mailing list