[libav-api] Segfault using avcodec_decode_audio3 in multithreaded app

Justin Ruggles justin.ruggles at gmail.com
Sun Feb 12 20:33:55 CET 2012


On 02/12/2012 12:19 PM, Ibrahim Sha'ath wrote:

> Hello all,
> 
> I've been wrestling with a segfault that occurs during multithreaded
> batch decoding jobs, and I hope someone can help. This issue seems only
> to occur with Windows Media files, and I can't always reproduce it (but
> I can get it to happen fairly consistently by decoding a batch of files
> that includes some WMAs).
> 
> My app is built in C++ using the Qt framework, and it targets Mac OS and
> Windows, though the segfault seems to be limited to Windows.
> 
> I assume that I must have made some mistake with the memory allocation
> in my code, or possibly overlooked some implication of running the
> decoding function across parallel threads. The process that handles
> decoding is here
> <https://github.com/ibsh/is_KeyFinder/blob/master/decoderlibav.cpp>; the
> function of primary interest is pasted below:
> 
> int LibAvDecoder::decodePacket(AVCodecContext* cCtx, AVPacket* avpkt,
> AudioStream* ab){
>   DECLARE_ALIGNED(16, uint8_t,
> outputBuffer)[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];


DECLARE_ALIGNED() doesn't work on the stack like that.

-Justin


More information about the libav-api mailing list