[sip-comm-dev] Re: JNIEncoder.java and size of Speex packets


#1

The Speex manual says in the "Packing and in-band signalling" section
at http://www.speex.org/docs/manual/speex-manual/node7.html#SECTION00710000000000000000:

Sometimes it is desirable to pack more than one frame per packet (or
other basic unit of storage). The proper way to do it is to call
speex_encode N times before writing the stream with
speex_bits_write. In cases where the number of frames is not
determined by an out-of-band mechanism, it is possible to include a
terminator code. That terminator consists of the code 15 (decimal)
encoded with 5 bits, as shown in Table 4. Note that as of version
1.0.2, calling speex_bits_write automatically inserts the terminator
so as to fill the last byte. This doesn't involves any overhead and
makes sure Speex can always detect when there is no more frame in a
packet.

So when you get to the point in the JNIEncoder code which says "Read
the encoded audio data from the SpeexBits into outputBuffer", I think
you could do:

- if you want to have the next frame packed into the previously
encoded frames, return OUTPUT_BUFFER_NOT_FILLED (i.e. don't let the
code bellow "Read the encoded audio data from the SpeexBits into
outputBuffer" execute) to tell JMF that you've successfully processed
the current frame but you're still not ready with the RTP packet and
you want the next frame to be given to you for encoding, and

- when you're ready to finish the pack, let the code bellow "Read the
encoded audio data from the SpeexBits into outputBuffer" execute.

How does that sound?

P.S. Please don't contact me privately, use the dev mailing list
because there's a much greater chance to get a timely answer there
(e.g. I was away for ten days) and because such questions may be of
interest to others as well.

ยทยทยท

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net