Mercurial > libavformat.hg
changeset 840:8834d33b7ca1 libavformat
minor fixes for invalid audio data patch by (Wolfram Gloger: wmglo, dent med uni-muenchen de)
author | michael |
---|---|
date | Sun, 14 Aug 2005 16:37:29 +0000 |
parents | 8f12a754d330 |
children | ba7631ba33a7 |
files | utils.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/utils.c Sun Aug 14 16:19:20 2005 +0000 +++ b/utils.c Sun Aug 14 16:37:29 2005 +0000 @@ -2188,20 +2188,24 @@ /* init PTS generation */ for(i=0;i<s->nb_streams;i++) { + int64_t den = AV_NOPTS_VALUE; st = s->streams[i]; switch (st->codec->codec_type) { case CODEC_TYPE_AUDIO: - av_frac_init(&st->pts, 0, 0, - (int64_t)st->time_base.num * st->codec->sample_rate); + den = (int64_t)st->time_base.num * st->codec->sample_rate; break; case CODEC_TYPE_VIDEO: - av_frac_init(&st->pts, 0, 0, - (int64_t)st->time_base.num * st->codec->time_base.den); + den = (int64_t)st->time_base.num * st->codec->time_base.den; break; default: break; } + if (den != AV_NOPTS_VALUE) { + if (den <= 0) + return AVERROR_INVALIDDATA; + av_frac_init(&st->pts, 0, 0, den); + } } return 0; }