diff options
author | Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> | 2005-08-14 16:37:29 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-08-14 16:37:29 +0000 |
commit | f0ff20a197dd98d2c0ecef3d183185a5c45c7196 (patch) | |
tree | 39cc1fe5f99539248b788929594261fc4b9f2c42 /libavformat | |
parent | 9450118bc799796ebb23338fe50fc60c3fabe566 (diff) | |
download | ffmpeg-f0ff20a197dd98d2c0ecef3d183185a5c45c7196.tar.gz |
minor fixes for invalid audio data patch by (Wolfram Gloger: wmglo, dent med uni-muenchen de)
Originally committed as revision 4524 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 0940f652c4..32a4c92dce 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2188,20 +2188,24 @@ int av_write_header(AVFormatContext *s) /* 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; } |