[FFmpeg-devel] [PATCH] Check stream time base before using it to set global duration.
Reimar Döffinger
Reimar.Doeffinger
Thu Feb 3 20:58:41 CET 2011
On Wed, Feb 02, 2011 at 03:24:12PM -0500, Justin Ruggles wrote:
>
> Fixes Issue 2475.
> ---
> libavformat/utils.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 4f51c26..a9d5a70 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1823,7 +1823,7 @@ static void av_update_stream_timings(AVFormatContext *ic)
> end_time = end_time1;
> }
> }
> - if (st->duration != AV_NOPTS_VALUE) {
> + if (st->duration != AV_NOPTS_VALUE && st->time_base.den) {
> duration1 = av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
> if (duration1 > duration)
> duration = duration1;
I don't really like that this still leaves applications to deal with an invalid
time_base.
Making sure that everything uses av_set_pts_info (patch for that still in limbo)
and making that function a nop (and just print a warning) for invalid values
seems more thorough and more user-friendly, though at more effort.
More information about the ffmpeg-devel
mailing list