Re: PIC32 port question
Erik Friesen <[email protected]> Fri, 25 Aug 2017 15:40:58 -0400
| Newsgroups | gmane.comp.audio.mp3.lame |
|---|---|
| Message-ID | <CAEuupitvy7_QDhBBAb5i0AP7xs5ip=7bGAzHD_T7ktxRCae5eA@mail.gmail.com> |
Adding to this, I don't see where this gets freed anywhere with multiple calls to lame_init_params ? On Fri, Aug 25, 2017 at 3:03 PM, Erik Friesen <[email protected]> wrote: > Ah, I found it. > > init_bit_stream_w returns void, but really this should check the > malloc for NULL, which it doesn't > > This is lame source 3.99.5. > > void > init_bit_stream_w(lame_internal_flags * gfc) > { > EncStateVar_t *const esv = &gfc->sv_enc; > > esv->h_ptr = esv->w_ptr = 0; > esv->header[esv->h_ptr].write_timing = 0; > > gfc->bs.buf = (unsigned char *) malloc(BUFFER_SIZE);//<-------------- > gfc->bs.buf_size = BUFFER_SIZE; > gfc->bs.buf_byte_idx = -1; > gfc->bs.buf_bit_idx = 0; > gfc->bs.totbit = 0; > } > > On Fri, Aug 25, 2017 at 2:56 PM, Erik Friesen <[email protected]> wrote: >> I am attempting to port the Lame Encoder to the pic32 mips. It may >> have nothing to do with the port, but I find an exception in >> putbits_noheaders >> >> Putting this helper inside >> >> putbits_noheaders(lame_internal_flags * gfc, int val, int j) >> { >> Bit_stream_struc *bs; >> bs = &gfc->bs; >> >> assert(j < MAX_LENGTH - 2); >> >> while (j > 0) { >> int k; >> if (bs->buf_bit_idx == 0) { >> bs->buf_bit_idx = 8; >> bs->buf_byte_idx++; >> assert(bs->buf_byte_idx < BUFFER_SIZE); >> /**MyHelper**/ >> PrintUart("bs->buf=%X[bs->buf_byte_idx=%i]\r\n", (int) bs->buf, >> bs->buf_byte_idx); >> while (UartTxInProgress()); >> /**End**/ >> bs->buf[bs->buf_byte_idx] = 0; >> } >> >> I get "bs->buf=0[bs->buf_byte_idx=0]" >> >> So can someone tell me where buf gets malloced? >> >> I have previously called it similar to: >> lame_t gf; >> gf = lame_init(); >> FlushMp3Buffer(gf); >> SetParams(gf); >> and it dies in lame_init_params(gf); ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot