aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-12-06 07:51:54 +0100
committerAnton Khirnov <anton@khirnov.net>2011-12-18 17:36:56 +0100
commit93fc5a9ff66637475025433c91876b80422f7bb4 (patch)
tree63de2a073f2bfb08d81fc7b0146e297ab08ab534 /libavformat
parentd49352c7cc22fd8928a761a373c3508be17c9f19 (diff)
downloadffmpeg-93fc5a9ff66637475025433c91876b80422f7bb4.tar.gz
lavf: force threads to 1 in avformat_find_stream_info()
Fixes avformat_find_stream_info() on streams with number of frames < thread count.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f42428563d..bc5b7e02da 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)