[Libav-user] Strange behavior depending on building mode

Daneelveloper daneelveloper at gmail.com
Tue Aug 21 02:27:36 EEST 2018

Hi everybody. This is my first post in this list so greetings to 
everyone and thank your for your help and contribution in advance. I'm 
working on Windows, gcc and CodeBlocks.

While making some audio encoding code and compiling it as *release* I 
got the error " [SWR @ 0209ad00] Input channel count and layout are 
unset" after this code:

av_opt_set_int(ost->swr_ctx, "in_channel_count", ost->enc->channels, 0);
ret = swr_init(ost->swr_ctx));

That code compiled as *debug* works flawlessly (no error message).

But if I simply add an error check line in-between, it works on 
*release* perfectly (no error message):

ret = av_opt_set_int(ost->swr_ctx, "in_channel_count", 
ost->enc->channels, 0);
if(ret < 0) fprintf(stderr, "\nError setting options: %s\n", 
ret = swr_init(ost->swr_ctx));

It seems calling av_err2str(ret) 'wipes' the error. I'll appreciate some 
help on the subject to understand this issue.

     Thank you.

More information about the Libav-user mailing list