Re: [TwoLAME-discuss] multi-threading
MPEG-Audio Layer 2 (MP2) encoder
Status: Beta
Brought to you by:
nhumfrey
From: Nicholas J H. <nj...@ae...> - 2012-03-01 11:22:36
|
Hello, This morning, I went through the code again and was unable to find any other global / static variables that might be causing this. Very odd. There are lots of static consts, and a couple of static lookup tables but they aren't affected by the encoding parameters. There is one more think that I am planning to check. I am sure you are, but just double checking - are you calling twolame_init() and storing it in a separate variable for each thread? Once an instance it created, it is unwise to change encoding parameters. Something to check is that you get the same behaviour for all the psychoacoustic models - that might help track down the problem. Sorry I couldn't be of more help. nick. > thanks for your response. yes. i have no problem when running > sequentially. i have also modified my pgm to do all the 44100 > conversions first, then the 48000, and have seen no problem yet with > that, even with 8 jobs running at once (8 cores). > > it is a very sneaky thing. only shows up in every 8-12 conversions, and > only once per file. > > i'm not too concerned. doing the 44100 and 48000 conversions separately > is working, so don't spend too much time on it. i can strip out that > part of the code and send it to you to test if you want. > > it still could be a system thing, throwing crazy bytes around, and it > just doesn't show up because all the frames are the same size when doing > the sample rates separately. > > and i haven't tried it on other systems. i will do that to see if it > follows to another system. i have a 4-core win7 i can try it on. let me > do that first, and i'll report back. > > dave allen > colorado > > > On 2/29/2012 4:34 PM, Nicholas Humfrey wrote: >> Hello, >> >> One of the things I worked hard on, when forking tooLAME to become >> TwoLAME, was making it thread-safe. I am pretty sure I managed to remove >> all the global and static variables, and as the threads don't interact >> with each other. So I am not sure what could be causing the problem. >> >> Are you sure that it is threading related and not just a more general >> bug? Does the same code run sequentially all work fine? >> >> >> nick. >> >> >> On 28 Feb 2012, at 05:01, dave allen wrote: >> >>> hi folks. the twolame encoder is really, really slick. but i have a >>> problem. we got new computers with 8 cores, so i have split an encoding >>> pgm up into threads to run in parallel. but i'm getting some random >>> errors - mp2 frames not aligned properly. >>> >>> (win7, i built the dll using your vc++ project file and visual c++ >>> 2010) >>> >>> what really makes the problem apparent is i'm encoding some files at >>> 44100 and others at 48000 at the same time. frame sizes 626 and 576 >>> respectively (192kbits, mono). my pgm to check the mp2 frames tells me >>> how many bytes it has to skip to sync up to the next good frame, and >>> when i'm encoding 44100 (frame size 626) it will report a bad frame, >>> and >>> 576 bytes to sync up to the next frame. so somehow 576 bytes have been >>> inserted where they don't belong. (and they do not have a valid frame >>> header.) when encoding 48000 (frame size 576) i'll see a bad frame, >>> then >>> 50 bytes to sync up (626-675=50). so 626 bytes have been inserted. >>> (without a valid frame header.) >>> >>> the resulting bad mp2 files for 48000 are 50 bytes bigger than a >>> "correct" file, and for the 44100 files, the bad files are 50 bytes >>> smaller, i presume from putting a >>> >>> i know multi-threading is quite the can of worms, but it may become >>> more >>> common as they add cores to cpus rather than speed -- until the next >>> speed breakthrough. just wondering what i might check on my end to make >>> sure i'm doing this right. it all works fine when i do one file at a >>> time, or when i do all the 48000 conversions, then the 44100. that's >>> what i'll do until i figure something else out. >>> >>> ain't threads wunnuful ?? >>> >>> thanks. >>> dave allen >>> colorado >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Keep Your Developer Skills Current with LearnDevNow! >>> The most comprehensive online learning library for Microsoft developers >>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, >>> MVC3, >>> Metro Style Apps, more. Free future releases when you subscribe now! >>> http://p.sf.net/sfu/learndevnow-d2d >>> _______________________________________________ >>> TwoLAME-discuss mailing list >>> Two...@li... >>> https://lists.sourceforge.net/lists/listinfo/twolame-discuss >> > |