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@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 > > ...
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@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 >> >> ...
<1091134545.3473AA89@s29.dngr.org> Message-ID: <1091166496.3071.6.camel@localhost> On jeu, 2004-07-29 at 14:55 -0600, David Barrett 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.Are you sure you're using 1.0.4 (with the right includes), because speex_bits_insert_terminator() should be there and speex_bits_write() should antomatically insert the terminator anyway. Jean-Marc> 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@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 > >> > >> ... > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev >-- Jean-Marc Valin <Jean-Marc.Valin@USherbrooke.ca> Universit? de Sherbrooke
<1091166496.3071.6.camel@localhost> Message-ID: <1091218090.1A2F4C22@s5.dngr.org> On Thu, 29 Jul 2004 11:49pm, Jean-Marc Valin wrote:> Are you sure you're using 1.0.4 (with the right includes), because > speex_bits_insert_terminator() should be there and speex_bits_write() > should antomatically insert the terminator anyway.Ah, my mistake. Yes, I have that function, I just misspelled it ('speek' instead of 'speex'). And it works as stated. However, the terminator bit doesn't appear to be appended automatically, as if I do not explicitly set it with that function, it does an infinite loop on decode. When I set it, however, everything works great. Thanks! -david