[Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work

Jan Drabner jan at jdrabner.eu
Mon Jan 27 22:09:52 CET 2014

Okay, I tried using swr_convert, but it always crashes when trying to 
divide by 0.
Basically, I have the same problem as those two guys:


However, I DO call swr_init() and there is no error whatsoever.
And it never reaches the point in swr_init() where context->postin would 
be set so it HAS to crash there.

Here is the code I use to init and to the swr_convert:

// Init context
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);

// Conversion
int outputSamples = swr_convert(swrContext,
                                         &p_destBuffer, 2048,
uint8_t**)p_frame->extended_data, p_frame->nb_samples);

As I said, I receive no errors, but the crash when FFmpeg tries to 
divide by 0 inside |swri_realloc_audio|.
What am I doing wrong?

Am 27.01.2014 20:46, schrieb Jan Drabner:
> Well. I don't.
> I was assuming that decode_audio4(...) was already giving output in 
> that format. I mean, after decoding, the data has to be in SOME 
> format, so I assumed it was a standard format. Possibly a bit naive on 
> my part.
> But then again, not a single sample with FFmpeg & OpenAL I found was 
> using aresample, so this is the first time I actually hear of it.
> I will try using it now and see how well that goes.
> Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos:
>> Jan Drabner <jan at ...> writes:
>>> However, I cannot get the sound to play at all with OpenAL.
>> Where do you call libswresample or aresample to convert
>> Carl Eugen
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140127/cbfb2568/attachment.html>

More information about the Libav-user mailing list