On Tue, Sep 28, 2004 at 01:33:52PM +0300, Csonka Tibor wrote:
> I've made a simple peer-to-peer telephone application wich uses
ogg-vorbis
> encoding over UDP. I have implemented the whole thing. My problem is that
> until the first ogg audio is compressed and sent over the network there is
a
> 3 second gap. I don't know how to get rid of this! I can supply you
with
> code if necessary. I am using 8000 bitrate at 16 bit/sample and mono
channel
> input and ABR encoding (also tried the rest of schemes VBR and managed).
A couple of suggestions. First, don't use ogg for low-latency
applications. That's where a lot of the latency is coming from.
Just pack the raw vorbis packets (and their length and a sequencing
number) into UDP packets directly. See the vorbis RTP draft for an
example.
Second, the reference vorbis encoder is itself fairly high latency.
Some of this is required by the format, but there are some hacks you
can do, such has forcing it to always use short blocks. Such things
will reduce quality/bitrate of course.
Third, depending on how your p2p network handles packet routing,
network delays may be creating some of the latency (3 seconds sounds
about right for direct routing of ogg vorbis though). You should
try to do shortest routing (or let the internet do it if direct
connection is possible). Any anonymity obfuscation will introduce
satellite phone style latency.
Have you looked at speex(.org)? Speex is another of our free codecs
optimized for voice and low-latency interactive applications. It's
not really appropriate for music, but offers much lower bitrates
for speech than vorbis.
Hope that's of some help. Good luck and keep us posted!
-r