[FFmpeg-devel] [PATCH V1 5/5] lavf/utils: add duration estimate method trace
Michael Niedermayer
michael at niedermayer.cc
Sat Sep 28 18:29:10 EEST 2019
On Sat, Sep 28, 2019 at 08:23:57PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
>
> add duration estimate method trace, it's can help to some duration
> issue trace or debug.
theres some english grammer issue here
>
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
> libavformat/utils.c | 16 +++++++++++++++-
> 1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index c0ccd8c..8620c6f 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2977,6 +2977,16 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
> {
> int i;
> AVStream av_unused *st;
> + const char *duration_method;
> + struct duration_mode {
> + enum AVDurationEstimationMethod mode;
> + const char *name; ///< short name for the duration estimation method
> + };
> + struct duration_mode duration_modes[] = {
> + { AVFMT_DURATION_FROM_PTS, "pts" },
> + { AVFMT_DURATION_FROM_STREAM, "stream" },
> + { AVFMT_DURATION_FROM_BITRATE,"bit rate" },
> + };
This maybe could be in a seperate function
> for (i = 0; i < ic->nb_streams; i++) {
> st = ic->streams[i];
> if (st->time_base.den)
> @@ -2984,10 +2994,14 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
> (double) st->start_time * av_q2d(st->time_base),
> (double) st->duration * av_q2d(st->time_base));
> }
> + for (i = 0; i < FF_ARRAY_ELEMS(duration_modes); i++)
> + if (ic->duration_estimation_method == duration_modes[i].mode)
> + duration_method = duration_modes[i].name;
> 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_method,
> (int64_t)ic->bit_rate / 1000);
> }
rest LGTM
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190928/afa564cd/attachment.sig>
More information about the ffmpeg-devel
mailing list