Removing these two lines leads to SIGFPE, and using cc->channel_layout also gives SIGFPE on some audio files. Using av_get_default_channel_layout(cc->channels) might be a solution. At least all my files play fine.