[FFmpeg-trac] #3358(swresample:new): swr_convert crash

FFmpeg trac at avcodec.org
Mon Jan 27 23:18:33 CET 2014

#3358: swr_convert crash
             Reporter:  TheSHEEEP    |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  swresample   |                  Version:
             Keywords:               |  unspecified
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
 Summary of the bug:
 When I call swr_convert() I get a crash somewhere inside .

 Here is a stack trace:
 #0  0x1413ad9a in ff_float_to_int16_a_sse2 ()
    from C:\MyProject\bin\Debug_Win\libFFmpegVideoPlugin_d.dll
 #1  0x141379ec in swri_audio_convert (ctx=0x3fba2e40,
 out=out at entry=0x4029136c, in=in at entry=0x4029110c, len=len at entry=5
     at libswresample/audioconvert.c:203
 #2  0x141315a8 in swr_convert_internal (in_count=576, in=0x4029110c,
 out_count=576, out=0x4029136c, s=0x4028fac0)
     at libswresample/swresample.c:618
 #3  swr_convert (s=0x4028fac0, out_arg=0x477dfd30, out_count=2048,
 in_arg=0x3fd29ae0, in_count=576)
     at libswresample/swresample.c:817

 This is the line that calls the sse2 function:
 ctx->simd_f(out->ch+ch, (const uint8_t **)in->ch+ch, off * (out->planar ?
 1 :out->ch_count));

 How to reproduce:

 Here is how I initialize the context and the output buffer:
 SwrContext* swrContext = swr_alloc_set_opts(NULL,
                 audioCodecContext->channel_layout, AV_SAMPLE_FMT_S16P,
 audioCodecContext->sample_fmt, audioCodecContext->sample_rate,
                 0, NULL);
 int result = swr_init(swrContext);

 // Create destination sample buffer
 uint8_t** destBuffer = NULL;
 int destBufferLinesize;
 av_samples_alloc_array_and_samples( &destBuffer,

 And here is the call to convert:
 int outputSamples = swr_convert(swrContext,
                                 destBuffer, 2048,
                                 (const uint8_t**)frame->extended_data,

 Also, I do not get any FFmpeg errors in the log and av_samples_alloc,
 swr_alloc_set_opts and swr_init do not return any errors, either.

 I am using a self compiled version of FFmpeg on Windows with MinGW

Ticket URL: <https://trac.ffmpeg.org/ticket/3358>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list