diff --git a/src/audio/codec/libavcodec.cpp b/src/audio/codec/libavcodec.cpp index 7ae5fc379..6dc4a4e54 100644 --- a/src/audio/codec/libavcodec.cpp +++ b/src/audio/codec/libavcodec.cpp @@ -329,8 +329,10 @@ static bool reinitialize_coder(struct libavcodec_codec_state *s, struct audio_de pthread_mutex_lock(s->libav_global_lock); /* open it */ - if (avcodec_open2(s->codec_ctx, s->codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); + if (int ret = 0; (ret = avcodec_open2(s->codec_ctx, s->codec, nullptr)) < 0) { + array errbuf{}; + av_strerror(ret, errbuf.data(), errbuf.size()); + LOG(LOG_LEVEL_ERROR) << MOD_NAME << "Could not open codec: " << errbuf.data() << "(" << ret << ")\n"; pthread_mutex_unlock(s->libav_global_lock); return false; }