Commit c8e309c2 authored by Michael Niedermayer's avatar Michael Niedermayer

lavf: Do not attempt to use frame multi threading when probing.

This fixes various problems with getting stream info. For example playback of the
file of Ticket88. Multithreaded find_stream_info should be reenabled
once it works correctly
This partly reverts 212fd3a1Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 19b945dc
...@@ -2384,10 +2384,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) ...@@ -2384,10 +2384,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int i, count, ret, read_size, j; int i, count, ret, read_size, j;
AVStream *st; AVStream *st;
AVPacket pkt1, *pkt; AVPacket pkt1, *pkt;
AVDictionary *one_thread_opt = NULL;
int64_t old_offset = avio_tell(ic->pb); int64_t old_offset = avio_tell(ic->pb);
int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those
int flush_codecs = 1; int flush_codecs = 1;
av_dict_set(&one_thread_opt, "threads", "1", 0);
for(i=0;i<ic->nb_streams;i++) { for(i=0;i<ic->nb_streams;i++) {
AVCodec *codec; AVCodec *codec;
st = ic->streams[i]; st = ic->streams[i];
...@@ -2409,15 +2412,19 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) ...@@ -2409,15 +2412,19 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
assert(!st->codec->codec); assert(!st->codec->codec);
codec = avcodec_find_decoder(st->codec->codec_id); codec = avcodec_find_decoder(st->codec->codec_id);
if (options)
av_dict_set(&options[i], "threads", "1", 0);
/* Ensure that subtitle_header is properly set. */ /* Ensure that subtitle_header is properly set. */
if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE
&& codec && !st->codec->codec) && codec && !st->codec->codec)
avcodec_open2(st->codec, codec, options ? &options[i] : NULL); avcodec_open2(st->codec, codec, options ? &options[i] : &one_thread_opt);
//try to just open decoders, in case this is enough to get parameters //try to just open decoders, in case this is enough to get parameters
if(!has_codec_parameters(st->codec)){ if(!has_codec_parameters(st->codec)){
if (codec && !st->codec->codec) if (codec && !st->codec->codec)
avcodec_open2(st->codec, codec, options ? &options[i] : NULL); avcodec_open2(st->codec, codec, options ? &options[i]
: &one_thread_opt);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment