<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I made some further progress by setting
      the OpenAL format to AL_FORMAT_STEREO_FLOAT32 instead of STEREO16.
      Makes sense, as the decoded frames are in FLTP format.<br>
      Also, I went back to not use swr_convert. It simply won't work and
      only crashes without any indication why. And FLTP seems to be the
      correct format already when openAL uses STEREO_FLOAT32.<br>
      <br>
      At least now, the sound is played at the correct speed. <br>
      However, it is still very high pitched, so something is still very
      much broken.<br>
      <br>
      Am 27.01.2014 22:09, schrieb Jan Drabner:<br>
    </div>
    <blockquote cite="mid:52E6CB20.8080902@jdrabner.eu" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Okay, I tried using swr_convert, but
        it always crashes when trying to divide by 0.<br>
        Basically, I have the same problem as those two guys:<br>
        <br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://stackoverflow.com/questions/14448413/why-am-i-getting-fpe-when-using-swresample-1-1">http://stackoverflow.com/questions/14448413/why-am-i-getting-fpe-when-using-swresample-1-1</a><br>
        and<br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="https://ffmpeg.org/trac/ffmpeg/ticket/1834">https://ffmpeg.org/trac/ffmpeg/ticket/1834</a><br>
        <br>
        However, I DO call swr_init() and there is no error whatsoever.<br>
        And it never reaches the point in swr_init() where
        context->postin would be set so it HAS to crash there.<br>
        <br>
        Here is the code I use to init and to the swr_convert:<br>
        <br>
        // Init context<br>
        SwrContext* swrContext = swr_alloc_set_opts(NULL, <br>
                        audioCodecContext->channel_layout,
        AV_SAMPLE_FMT_S16P, audioCodecContext->sample_rate,<br>
                        audioCodecContext->channel_layout,
        audioCodecContext->sample_fmt,
        audioCodecContext->sample_rate, <br>
                        0, NULL);<br>
        int result = swr_init(swrContext);<br>
        <br>
        // Conversion<br>
        int outputSamples = swr_convert(swrContext, <br>
                                                &p_destBuffer,
        2048,   <br>
                                                (const
        uint8_t**)p_frame->extended_data, p_frame->nb_samples);<br>
        <br>
        As I said, I receive no errors, but the crash when FFmpeg tries
        to divide by 0 inside <code><span class="pln">swri_realloc_audio</span></code>.<br>
        What am I doing wrong?<br>
        <br>
        Am 27.01.2014 20:46, schrieb Jan Drabner:<br>
      </div>
      <blockquote cite="mid:52E6B78C.5050507@jdrabner.eu" type="cite">Well.

        I don't. <br>
        <br>
        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. <br>
        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. <br>
        <br>
        I will try using it now and see how well that goes. <br>
        <br>
        Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos: <br>
        <blockquote type="cite">Jan Drabner <a moz-do-not-send="true"
            class="moz-txt-link-rfc2396E" href="mailto:jan@..."><jan@...></a>
          writes: <br>
          <br>
          <blockquote type="cite">However, I cannot get the sound to
            play at all with OpenAL. <br>
          </blockquote>
          Where do you call libswresample or aresample to convert <br>
          from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 ? <br>
          <br>
          Carl Eugen <br>
          <br>
          _______________________________________________ <br>
          Libav-user mailing list <br>
          <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
          <br>
          <a moz-do-not-send="true" class="moz-txt-link-freetext"
            href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
          <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>