On Fri Feb 28 07:40:35 2025 +0000, Rémi Bernon wrote:
else if (par->codec_id == AV_CODEC_ID_MP3) { int channels; #if LIBAVUTIL_VERSION_MAJOR >= 58 channels = par->ch_layout.nb_channels; #else channels = par->channels; #endif if (!channels) avformat_find_stream_info( demuxer->ctx, NULL ); }
But I wonder if this is this the best way to do this. Maybe we should call `avformat_find_stream_info` unconditionally for some formats. It was avoided because it can take a bit more time and we want demuxer initialization to be fastest as possible (to match native and address some Unreal Engine potential race condition), but that's maybe only specific to MP4 as far as I know.
So something like: ```suggestion:-0+0 }
if (!(av_codec_get_tag(demuxer->ctx->iformat->codec_tag, AV_CODEC_ID_MPEG4))) { avformat_find_stream_info(demuxer->ctx, NULL); } ``` ?
Although it would probably make more sense to do this in `demuxer_create` after the call to `avformat_open_input` but before the call to `demuxer_create_streams`.
But I'm not that familiar with the FFmpeg API (which is why I narrowed the scope of the change), so I'm happy to take your lead on this.