kolyvan / kxmovie

movie player for iOS using ffmpeg
2.83k stars 916 forks source link

swr_init(swrContext) fail and return -22 #164

Open vhikd opened 7 years ago

vhikd commented 7 years ago

Hello,

When I play some audio with FFMpeg 3.0 or later , the KxMovieDecoder.m on the line 905, failed .

`id audioManager = [KxAudioManager audioManager]; swrContext = swr_alloc_set_opts(NULL, av_get_default_channel_layout(audioManager.numOutputChannels), AV_SAMPLE_FMT_S16, audioManager.samplingRate, av_get_default_channel_layout(codecCtx->channels), codecCtx->sample_fmt, codecCtx->sample_rate, 0, NULL);

    int sw = swr_init(swrContext);
    if (!swrContext ||
        sw ) {

        if (swrContext)
            swr_free(&swrContext);
         avcodec_close(codecCtx);

        return kxMovieErroReSampler;
    }`

The sw=-22,any suggestions to solve this problem?

Wish your message . Thanks for your help.