|
@@ -1804,8 +1804,9 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
|
|
"Estimating duration from bitrate, this may be inaccurate\n");
|
|
|
}
|
|
|
|
|
|
-#define DURATION_MAX_READ_SIZE 250000LL
|
|
|
-#define DURATION_MAX_RETRY 6
|
|
|
+#define DURATION_DEFAULT_MAX_READ_SIZE 250000LL
|
|
|
+#define DURATION_DEFAULT_MAX_RETRY 6
|
|
|
+#define DURATION_MAX_RETRY 1
|
|
|
|
|
|
/* only usable for MPEG-PS streams */
|
|
|
static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
|
@@ -1813,6 +1814,8 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
|
|
FFFormatContext *const si = ffformatcontext(ic);
|
|
|
AVPacket *const pkt = si->pkt;
|
|
|
int num, den, read_size, ret;
|
|
|
+ int64_t duration_max_read_size = ic->duration_probesize ? ic->duration_probesize >> DURATION_MAX_RETRY : DURATION_DEFAULT_MAX_READ_SIZE;
|
|
|
+ int duration_max_retry = ic->duration_probesize ? DURATION_MAX_RETRY : DURATION_DEFAULT_MAX_RETRY;
|
|
|
int found_duration = 0;
|
|
|
int is_end;
|
|
|
int64_t filesize, offset, duration;
|
|
@@ -1848,7 +1851,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
|
|
filesize = ic->pb ? avio_size(ic->pb) : 0;
|
|
|
do {
|
|
|
is_end = found_duration;
|
|
|
- offset = filesize - (DURATION_MAX_READ_SIZE << retry);
|
|
|
+ offset = filesize - (duration_max_read_size << retry);
|
|
|
if (offset < 0)
|
|
|
offset = 0;
|
|
|
|
|
@@ -1857,7 +1860,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
|
|
for (;;) {
|
|
|
AVStream *st;
|
|
|
FFStream *sti;
|
|
|
- if (read_size >= DURATION_MAX_READ_SIZE << (FFMAX(retry - 1, 0)))
|
|
|
+ if (read_size >= duration_max_read_size << (FFMAX(retry - 1, 0)))
|
|
|
break;
|
|
|
|
|
|
do {
|
|
@@ -1911,7 +1914,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
|
|
}
|
|
|
} while (!is_end &&
|
|
|
offset &&
|
|
|
- ++retry <= DURATION_MAX_RETRY);
|
|
|
+ ++retry <= duration_max_retry);
|
|
|
|
|
|
av_opt_set_int(ic, "skip_changes", 0, AV_OPT_SEARCH_CHILDREN);
|
|
|
|