diff --git a/libavformat/utils.c b/libavformat/utils.c index f42428563d68c224cc0a36f57c8bd382714ef936..bc5b7e02da194ff93f682f95e97a647862f6d99e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2291,6 +2291,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) assert(!st->codec->codec); codec = avcodec_find_decoder(st->codec->codec_id); + /* this function doesn't flush the decoders, so force thread count + * to 1 to fix behavior when thread count > number of frames in the file */ + if (options) + av_dict_set(&options[i], "threads", "1", 0); + /* Ensure that subtitle_header is properly set. */ if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec)