aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-01 15:26:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-01 15:49:32 +0100
commit24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b (patch)
treefca805713a1d605e9ea6df8e422e96ad09914e43
parentb50e003e1cb6a215df44ffa3354603bf600b4aa3 (diff)
downloadffmpeg-24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b.tar.gz
avformat/utils: Search harder for missing stream information in flv by default
Fixes Ticket4133 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/utils.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 693b0339cf..798c6123e0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2989,6 +2989,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int orig_nb_streams = ic->nb_streams;
int flush_codecs;
int64_t max_analyze_duration = ic->max_analyze_duration2;
+ int64_t max_stream_analyze_duration;
int64_t probesize = ic->probesize2;
if (!max_analyze_duration)
@@ -2999,11 +3000,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN);
+ max_stream_analyze_duration = max_analyze_duration;
if (!max_analyze_duration) {
- if (!strcmp(ic->iformat->name, "flv") && !(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
- max_analyze_duration = 10*AV_TIME_BASE;
- } else
- max_analyze_duration = 5*AV_TIME_BASE;
+ max_stream_analyze_duration =
+ max_analyze_duration = 5*AV_TIME_BASE;
+ if (!strcmp(ic->iformat->name, "flv"))
+ max_stream_analyze_duration = 30*AV_TIME_BASE;
}
if (ic->pb)
@@ -3076,6 +3078,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
count = 0;
read_size = 0;
for (;;) {
+ int analyzed_all_streams;
if (ff_check_interrupt(&ic->interrupt_callback)) {
ret = AVERROR_EXIT;
av_log(ic, AV_LOG_DEBUG, "interrupted\n");
@@ -3115,7 +3118,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
break;
}
+ analyzed_all_streams = 0;
if (i == ic->nb_streams) {
+ analyzed_all_streams = 1;
/* NOTE: If the format has no header, then we need to read some
* packets to get most of the streams, so we cannot stop here. */
if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
@@ -3223,7 +3228,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
&& st->info->fps_last_dts != AV_NOPTS_VALUE)
t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q));
- if (t >= max_analyze_duration) {
+ if (t >= (analyzed_all_streams ? max_analyze_duration : max_stream_analyze_duration)) {
av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %"PRId64" reached at %"PRId64" microseconds\n",
max_analyze_duration,
t);