kolyvan/kxmovie

swr_init(swrContext) fail and return -22

vhikd opened this issue · 0 comments

vhikd commented

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.