[Speex-dev] Multiple Frames per Packet

Tom Grandgent tgrand
Thu Jul 29 14:00:04 PDT 2004


Figures.  I knew I should've just pasted my code:
..
while (ret != -1 && speex_bits_remaining(&bits) > 0);

I am using a newer version of Speex, so I guess the terminator
is a relatively new thing.  I'm not even sure if it's necessary,
but I think Jean-Marc recommended using it back when I asked this
question awhile ago..?

Anyway, glad it's working for you.

Tom

David Barrett (dbarrett at quinthar.com) wrote:
>
> Aha.  Thanks.  I don't seem to have speex_bits_insert_terminator(&bits);
> in my installed version (1.0.4), but I was able to use
> speex_bits_remaining(&bits).  However, speex_bits_remaining(&bits)
> doesn't return 0 -- it returns -1 when it's empty.
>
> Odd, eh?  But it works.  Thanks!
>
> -david
>
> On Thu, 29 Jul 2004 2:37pm, Tom Grandgent wrote:
> > David,
> >
> > Here's the trick ... do this just before your speex_bits_write():
> >
> > speex_bits_insert_terminator(&bits);
> >
> > Then, when decoding, keep calling speex_decode() until it returns -1
> > or speex_bits_remaining(&bits) returns 0.
> >
> > Works for me, anyway.
> >
> > Tom
> >
> > David Barrett (dbarrett at quinthar.com) wrote:
> >>
> >>  Hi, I'm using Speex and I want to pack multiple frames into a single
> >>  packet.  The manual (section 4.5) says to call "speex_encode()"
> >>  multiple times before calling "speex_bits_write()", and then call
> >>  "speex_decode()" until it returns -1.  However, when I try that
> >>  "speex_decode()" never returns -1, and it enters an infinite loop.
> >>
> >>  I'm using 1.0.4.
> >>
> >>  Any suggestions?  Surely this isn't a new question.  (Incidentally,
> >>  the Xiph.org archives of this mailing list appear to be offline.
> >>  Where are they now, or when will they come back online?)
> >>
> >>  I've included some clips from my code below:
> >>
> >>  -david
> >>
> >>  ...



More information about the Speex-dev mailing list