Skip to main content

Topic: Is LAME reenterable? (Read 2764 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Istrebitel
  • [*][*]
Is LAME reenterable?
Greetings.

I am experimenting with Lame from programming point of view, and having wierd results. I have a question - is LAME reenterable, meaning, does it store anything in its inner variables, and can i encode/decode multiple files at once (if i keep multiple global lame structure instances of course)

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Is LAME reenterable?
Reply #1
what functions do you use?

  • Istrebitel
  • [*][*]
Is LAME reenterable?
Reply #2
Well, i basically do the same that command line utility does (one that comes with lame) - i use lame_init, i set different parameters, then i use the encode/decode functions in a loop, then close.

  • Istrebitel
  • [*][*]
Is LAME reenterable?
Reply #3
I found out, the decoder supplied with LAME was actually non-reentrable, not LAME encoder.

In layer3.c at 1645 it reads:

struct III_sideinfo sideinfo;

So, a global variable is declared, and if multiple decodings are attempted at once, chaos ensues.

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Is LAME reenterable?
Reply #4
IIRC lame_decode_* functions aren't thread-safe, but hip_decode_* are.

Quote
In layer3.c at 1645 it reads:

What version do you use?
  • Last Edit: 13 July, 2012, 06:19:48 AM by lvqcl

  • robert
  • [*][*][*][*][*]
  • Developer
Is LAME reenterable?
Reply #5
I couldn't find any version with that text at line 1645. Anyway, version 3.99.5 should be OK to use, as I fixed that issue during the 3.99 development.
  • Last Edit: 13 July, 2012, 08:10:17 AM by robert

  • Istrebitel
  • [*][*]
Is LAME reenterable?
Reply #6
lvqcl, thanks, is there any official information about thread-safeness of LAME?

Robert, thanks alot. 

I think what you mean is that my number at which struct III_sideinfo sideinfo; occurs is different, thats because as i said, i was experimenting, so i could've added some code over that line.

I think i'll just apply those changes i am missing since my version and see if they help.
  • Last Edit: 13 July, 2012, 11:00:04 AM by Istrebitel