Message ID | 1569749274-13151-6-git-send-email-mypopydev@gmail.com |
---|---|
State | Accepted |
Commit | 6ca3d34ff8490fb1efa0cc3dc06b6bbb58151c53 |
Headers | show |
On Sun, Sep 29, 2019 at 05:27:54PM +0800, Jun Zhao wrote: > From: Jun Zhao <barryjzhao@tencent.com> > > add new function duration_estimate_name to dump duration estimate > method, it's will help to debug some duration issue. > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > --- > libavformat/utils.c | 15 ++++++++++++++- > 1 files changed, 14 insertions(+), 1 deletions(-) LGTM thx [...]
On Mon, Sep 30, 2019 at 4:13 AM Michael Niedermayer <michael@niedermayer.cc> wrote: > > On Sun, Sep 29, 2019 at 05:27:54PM +0800, Jun Zhao wrote: > > From: Jun Zhao <barryjzhao@tencent.com> > > > > add new function duration_estimate_name to dump duration estimate > > method, it's will help to debug some duration issue. > > > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > > --- > > libavformat/utils.c | 15 ++++++++++++++- > > 1 files changed, 14 insertions(+), 1 deletions(-) > > LGTM > > thx > > [...] Ths, will apply
diff --git a/libavformat/utils.c b/libavformat/utils.c index 112d19b..60f0229 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2934,6 +2934,18 @@ skip_duration_calc: } } +/* 1:1 map to AVDurationEstimationMethod */ +static const char *duration_name[] = { + [AVFMT_DURATION_FROM_PTS] = "pts", + [AVFMT_DURATION_FROM_STREAM] = "stream", + [AVFMT_DURATION_FROM_BITRATE] = "bit rate", +}; + +static const char *duration_estimate_name(enum AVDurationEstimationMethod method) +{ + return duration_name[method]; +} + static void estimate_timings(AVFormatContext *ic, int64_t old_offset) { int64_t file_size; @@ -2979,9 +2991,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) (double) st->duration * av_q2d(st->time_base)); } av_log(ic, AV_LOG_TRACE, - "format: start_time: %0.3f duration: %0.3f bitrate=%"PRId64" kb/s\n", + "format: start_time: %0.3f duration: %0.3f (estimate from %s) bitrate=%"PRId64" kb/s\n", (double) ic->start_time / AV_TIME_BASE, (double) ic->duration / AV_TIME_BASE, + duration_estimate_name(ic->duration_estimation_method), (int64_t)ic->bit_rate / 1000); } }